Click here to Skip to main content
Sign Up to vote bad
good
See more: C#ASP.NET
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 27 Dec '12 - 1:30


2 solutions

Hi ,
Check this
 string prevMont= DateTime.Now.AddMonths(-1).ToString();
Best Regards
M.Mitwalli
  Permalink  
Try:
DateTime now = DateTime.Now;
DateTime lastMonth = now.AddMonths(-1);
DateTime twoMonthsAgo = now.AddMonths(-2);
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Mohammed Hameed 268
1 Sergey Alexandrovich Kryukov 238
2 OriginalGriff 236
3 Mayur_Panchal 153
4 Dave Kreskowiak 125
0 Sergey Alexandrovich Kryukov 8,171
1 OriginalGriff 6,236
2 CPallini 3,482
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid