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 ...

Get .NET Common Language Runtime Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.