Counting Date Backwards in C# -
this question has answer here:
- how previous month date in asp.net 4 answers
can please show me how decrement datetime month? example, today august 2013, count july 2013, june 2013, may 2013, april 2013 on , forth. , also, year must change when month reach january going december. counting datetime backwards. help!
you can use addmonths
:
months: number of months. months parameter can negative or positive.
the usage like:
var updatedtime = yourdatetime.addmonths(-1);
note calling addmonths
returns new instance. numbers.
Comments
Post a Comment