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

c++ - Linked List error when inserting for the last time -

c++ - Issues with OpenGL referencing when compiling in Ubuntu terminal -

java - A* catch if unpossible to reach a point -