Click here to Skip to main content
16,017,881 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
how to find the previous months of the current month

i got as DEC-2012

i need Nov-2012
and Oct-2012


using datetime or any code snippets please help me....
Posted

Hi ,
Check this
C#
string prevMont= DateTime.Now.AddMonths(-1).ToString();

Best Regards
M.Mitwalli
 
Share this answer
 
Try:
C#
DateTime now = DateTime.Now;
DateTime lastMonth = now.AddMonths(-1);
DateTime twoMonthsAgo = now.AddMonths(-2);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900