I want to get exactly one year back from the current date (which I am passing) in .Net. Can anyone provide me a function or code that will perform this?
To add years to a date: Use the getFullYear() method to get the year of the specific date. Use the setFullYear() method to set the year for the date. The setFullYear method takes a number representing the year as a parameter and sets the value for the date.
You can use the AddYears() method:
DateTime.Now.AddYears( -1 );
Try DateTime.AddYears(-1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With