O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

System.DateTime

An instance of a DateTime structure represents a point in time specified by a date and a time. This structure offers many date manipulation methods. Listing B.5 shows an example of some of the functionality of this structure (datetime.cs).

Listing B.5. DateTime Example
 static void Main(string [] args) { Console.WriteLine("Min: {0} ", DateTime.MinValue); Console.WriteLine("Max: {0} ", DateTime.MaxValue); DateTime date = DateTime.Now; Console.WriteLine("Long DateTime {0} {1} ", date.ToLongDateString(), date.ToLongTimeString()); Console.WriteLine("Date: {0} ", date.Date); Console.WriteLine("Month: {0} ", date.Month); Console.WriteLine("Day: {0} ", date.Day); Console.WriteLine("Day of week: {0} ", date.DayOfWeek); Console.WriteLine("Day ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required