Published
- 1 min read
DateTime previous day c#
The solution for this is noted below
DateTime previous day c#
Solution
public DateTime GetLastDayPrevMonth(int month, int year)
{
return new DateTime(year, month, 1).AddDays(-1);
// AddMonth(-1) for previous month
}
Try other methods by searching on the site. That is if this doesn’t work