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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ganesan CRank #369 · 6.8K reputationPosted Aug 19, 2021, 6:33 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 19, 2021, 6:09 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 19, 2021, 6:23 AM EDT
Dinesh DRank #5,346 · 302 reputationPosted Aug 19, 2021, 6:45 AM EDT
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);
Meena Bisht139 reputationPosted Aug 21, 2021, 5:24 AM EDT
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,