How do I subtract a month from a date object in VB.NET?
I have tried:
Today.AddMonths(-1)
However, given that Today is 01-Jan-2010, the
This works fine, you need to remember that the DateTime is imutable.
Dim d As DateTime
d = New DateTime(2010, 1, 1)
d = d.AddMonths(-1)
Have a look at DateTime Structure
A calculation on an instance of DateTime, such as Add or Subtract, does not modify the value of the instance. Instead, the calculation returns a new instance of DateTime whose value is the result of the calculation.