// C# code for testing the members of the DateTime class // specified in the abbreviated UML diagram for DateTime. protected void Page_Load(object sender, EventArgs e) { // Declare reference variables for DateTime objects. DateTime d, f, g, h; // Instantiate DateTime objects using constructors. d = new DateTime( ); f = new DateTime(1776, 7, 4); g = new DateTime(1969, 7, 20, 15, 17, 0); // Instantiate DateTime objects using static // property DateTime.Now h = DateTime.Now; // Test ToString methods for DateTime objects. Response.Write(

+ d.ToString( ) +
); Response.Write(f.ToString( ) +
); Response.Write(g.ToString( ) +
); Response.Write(h.ToString( ) +

); // Test DateTime properties. Response.Write(

Year = + g.Year +
); Response.Write(Month = + g.Month +
); Response.Write(Day = + g.Day +
); Response.Write(Hour = + g.Hour +
); Response.Write(Minute = + g.Minute +
); Response.Write(Second = + g.Second +
); Response.Write(DayOfWeek = + g.DayOfWeek +

); // Test Add methods. g = g.AddYears(50); g = g.AddMonths(3); g = g.AddDays(2); g = g.AddHours(5); g = g.AddMinutes(10); g = g.AddSeconds(30); Response.Write(g.ToString( )); }