How to add 1 month and 1 year ahead in c#.
Loading
How to add 1 month and 1 year ahead in c#.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ganesan CPosted Aug 19, 2021, 10:33 AM
Meena BishtPosted Aug 21, 2021, 9:24 AM
Hello ,
You can try the below coode to add additonal 1 month and 1 Year.
DateTime dtToday = DateTime.Now;
DateTime addDaysAndMonths = dtToday.AddDays(30).AddMonths(12);
string newDate=addDaysAndMonths.ToString("yyyy-MM-dd HH:mm:ssZ");
Thanks,
Dinesh DPosted Aug 19, 2021, 10:45 AM
Next Year One month Ahead
var nextyearandonemonth = DateTime.Today.AddMonths(13);
Next year from Current Date
var nextyear = DateTime.Today.AddMonths(12);
Next Month
var nexmonth = DateTime.Today.AddMonths(1);
Ganesan CPosted Aug 19, 2021, 10:23 AM
Ganesan CPosted Aug 19, 2021, 10:09 AM