Counting Date Backwards in C# -


this question has answer here:

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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -