// Returns number of days in the current month int NumDays = DateTime.DaysInMonth(DateTime.Now.Year,DateTime.Now.Month); // Creates a DateTime that is the last day of the current month new DateTime(DateTime.Now.Year,DateTime.Now.Month,DaysInMonth(DateTime.Now.Year,DateTime.Now.Month));>>Using C#, how do you get the first day in the current month? Or the last day in the current month?
>System.DateTime dateFirstOfMonth = new System.DateTime(System.DateTime.Now.Year, System.DateTime.Now.Month, 1, 0, 0, 0); >System.TimeSpan oneDay = new System.TimeSpan(1, 0, 0, 0, 0); >System.DateTime dateLastOfMonth = dateFirstOfMonth.Subtract(oneDay); >>