CSharp examples for System:DateTime Day
Returns the first day of the current month.
using System.Globalization; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*w w w . ja va 2 s . c o m*/ public class Main{ /// <summary> /// Returns the first day of the current month. /// </summary> /// <returns></returns> public static DateTime StartOfMonth() { return StartOfMonth(DateTime.UtcNow); } /// <summary> /// Returns the first day of the month. /// </summary> /// <param name="d"></param> /// <returns></returns> public static DateTime StartOfMonth(DateTime d) { return new DateTime(d.Year, d.Month, 1); } }