public class LastDayOfMonth { public static void CalcLastDayOfMonth() { DateTime today = DateTime.Now; int days = DateTime.DaysInMonth(today.Year, today.Month); System.Console.WriteLine(new DateTime(today.Year, today.Month, days).ToString("yyyy-MM-dd")); } }