// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; class MainClass { public static void Main(string[] args) { DateTime birth = DateTime.Parse("28/07/1979"); Console.WriteLine(birth + " " + GetDayOfWeek(birth)); Console.WriteLine(birth.ToString("dddd")); } public static string GetDayOfWeek(DateTime dt) { switch(dt.DayOfWeek) { case DayOfWeek.Sunday: return "Sunday"; case DayOfWeek.Monday: return "Monday"; case DayOfWeek.Tuesday: return "Tuesday"; case DayOfWeek.Wednesday: return "Wednesday"; case DayOfWeek.Thursday: return "Thursday"; case DayOfWeek.Friday: return "Friday"; case DayOfWeek.Saturday: return "Saturday"; default: throw new Exception("Not a valid day"); } } }