// Test DateTime class. public static void Main() { // Create DateTime object for current date and time. DateTime t = DateTime.Now; // Create DateTime object for July 4, 1776 at 2:35:11pm. DateTime u = new DateTime(1776, 7, 4, 14, 35, 11); // Test ToString method for t. Console.WriteLine(t.ToString()); // Test ToString method for u. ToString is automatically // called when any object is printed with Console.WriteLine. Console.WriteLine(u); // Create DateTime object for today's date, but at 12:00:00am. DateTime v = DateTime.Today; Console.WriteLine(v); // Test Month and Hour properties of t. Console.WriteLine("Month: {0}; Hour: {1}", t.Month, t.Hour); // Test static properties MinValue and MaxValue of DateTime class. Console.WriteLine(DateTime.MinValue + " " + DateTime.MaxValue); // Test IsDaylightSavingTime methods for t and u. Console.WriteLine(t.IsDaylightSavingTime()); Console.WriteLine(u.IsDaylightSavingTime()); // Add 2 billion seconds to t, which is about 31 years. t = t.AddSeconds(2000000000); Console.WriteLine(t); Console.ReadLine(); }