SyntaxFix
Write A Post
Hire A Developer
Questions
I use this simple one-liner:
public static DateTime GetLastDayOfPreviousMonth(this DateTime date) { return date.AddDays(-date.Day); }
Be aware, that it retains the time.