CSharp examples for Language Basics:Date Time
Get "now" and the day of week now.
using System;//from w w w . j a v a 2 s . c om class Program { static void Main(string[] args) { // DateTime thisMoment = DateTime.Now; DayOfWeek dayOfWeek = DateTime.Now.DayOfWeek; Console.WriteLine("Today (right now) is {0}, {1}", dayOfWeek, thisMoment); // e.g. "Sunday, 7/15/2007 2:24:37 PM". Console.WriteLine("This year is {0}", thisMoment.Year); } }