FirstDayOfMonth / LastDayOfMonth

public static class DateExtensions
	public static string FirstDayOfMonth(this DateTime date)
		return new DateTime(date.Year, date.Month, 1).ToString("MM/dd/yyyy");

	public static string LastDayOfMonth(this DateTime date)
		return new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1).AddDays(-1).ToString("MM/dd/yyyy");
DateTime dateToday = DateTime.Now;

Console.WriteLine("First Day: {0}", dateToday.FirstDayOfMonth());
Console.WriteLine("Last Day: {0}", dateToday.LastDayOfMonth());


Simple way to Get the first and last day of the specified date.


Double click on the code to select all.