Mega Code Archive

 
Categories / C# / Date Time
 

Gets the day of the week

using System; class Sample  {     public static void Main()      {         DateTime dt = new DateTime(2010, 5, 1);         Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}",                             dt, dt.DayOfWeek == DayOfWeek.Thursday);         Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek);     } }