How can I get previous month and year in C#

130 Views
DateTime dt = DateTime.Now;
dt = dt.AddMonths(-1);
int month = dt.Month;
int Year = dt.Year;
Skip to toolbar