I want to get data from database which is saved from past 3 months for that i have current date and time but how to calculate 3 months ego date and time, SO that i can pass these 2 dates in the query and get the data which was saved between these dates
Use the AddMonths
method:
DateTime ago = DateTime.Now.AddMonths(-3);
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