CSharp examples for System:DateTime Month
Returns the FIRST possible time unit for provided MONTH in dateTime
using System.Globalization; using System;/* w w w . ja v a 2 s . c om*/ public class Main{ /// <summary> /// Returns the FIRST possible time unit for provided MONTH in dateTime /// </summary> public static DateTime StartOfMonth(this DateTime dateTime) { DateTime startOfMonth = dateTime.AddDays(-dateTime.Day + 1).Date; return startOfMonth; } }