J
Jimbo
Anyone know how I can subtract 12 months from the current date?
DateTime twelveMonthsPrevious = DateTime.Now.AddMonths(-12);
twelveMonthsPrevious = DateTime.Now.AddYears(-1);
Hi Jimbo,
You can use AddMonths method and pass -12 as the parameter. Which basically subtracts 12 months from the date. Basically the method does both add and subtract.
check this link,
<http://msdn.microsoft.com/library/d...ml/frlrfsystemdatetimeclassaddmonthstopic.asp>
Hope this helps...
Regards,
Madhu
MVP | MCSD.NET
----- Jimbo wrote: -----
Anyone know how I can subtract 12 months from the current date?
Jimbo,
You can get different string representations of the date by passing
parameters to the ToString method on the DateTime instance. Check out the
documentation for the DateTimeFormatInfo class to find the string formats
you can pass to the ToString method to output different formats for the
DateTime instance.
Hope this helps.
Jimbo said:Hi, thanks for that. But how can I covert the date to different regional
areas - usa mm/dd/yyyy, euro dd/mm/yyyy ?