DateTime startOfMonth = new DateTime(2014, 5, 1); //new DateTime(year, month, 1); DateTime endOfMonth = new DateTime(2014, 5, DateTime.DaysInMonth(2014, 5)); //new DateTime(year, month, DateTime.DaysInMonth(year, month));
DateTime.Now
DateTime dt = DateTime.Now; DateTime dtBegin = dt.AddDays(-(dt.Day - 1)); DateTime dtEnd = dtBegin.AddMonths(1).AddDays(-1); Debug.WriteLine ("Begin Date: {0}",dtBegin); Debug.WriteLine ("End Date: {0}",dtEnd);
DateTime dtSelectedDate = DateTime.Now; DateTime dtFirstDayOfMonth = new DateTime(1, dtSelectedDate.Month, dtSelectedDate.Year); DateTime dtLastDayOfMonth = dtFirstDayOfMonth.AddMonths(1).AddDays(-1);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)