1
Reply

C# previous month access

dc

dc

Jan 14 2013 11:01 AM
1k
In a C# 2008 desktop application, I want to be able to access a directory path location where the month and year is part of the filename.

The statement I have for this right now is the following:

String Format_Date =  today.ToString("MM-yyyy");


I would like to change the code above to month to the previous month? Also if the previous month is December and the year is one year less,
how would  you make the coding change?

In other words, right now it is Jan. 2013 and I want to access the previous month which is Dec. 2012?

Can you show me code on how to accomplish this goal?

Answers (1)