using System;
using System.Globalization;
public class MainClass{
public static void Main() {
// Sets a DateTime to April 13, 2010 of the Gregorian calendar.
DateTime myDT = new DateTime( 2010, 4, 13, new GregorianCalendar() );
// Uses the default calendar of the InvariantCulture.
Calendar myCal = CultureInfo.InvariantCulture.Calendar;
DisplayValues( myCal, myDT );
}
public static void DisplayValues( Calendar myCal, DateTime myDT ) {
Console.WriteLine( "Era: {0}", myCal.GetEra( myDT ) );
Console.WriteLine( "Year: {0}", myCal.GetYear( myDT ) );
Console.WriteLine( "Month: {0}", myCal.GetMonth( myDT ) );
Console.WriteLine( "DayOfYear: {0}", myCal.GetDayOfYear( myDT ) );
Console.WriteLine( "DayOfMonth: {0}", myCal.GetDayOfMonth( myDT ) );
Console.WriteLine( "DayOfWeek: {0}", myCal.GetDayOfWeek( myDT ) );
Console.WriteLine( "Hour: {0}", myCal.GetHour( myDT ) );
Console.WriteLine( "Minute: {0}", myCal.GetMinute( myDT ) );
Console.WriteLine( "Second: {0}", myCal.GetSecond( myDT ) );
Console.WriteLine( "Milliseconds: {0}", myCal.GetMilliseconds( myDT ) );
}
}