Some C# code to determine the last day of the current month.
//One liner
DateTime lastday = DateTime.Today.AddMonths(1).AddDays(-DateTime.Today.Day);
// Extra line to make it more readable
DateTime today = DateTime.Today;
DateTime lastday = today.AddMonths(1).AddDays(-today.Day);
No comments:
Post a Comment