static DateTime previousMonth(DateTime m) { var year = m.year; var month = m.month; if (month == 1) { year--; month = 12; } else { month--; } return DateTime(year, month); }