コード例 #1
0
    public static void Main()
    {
        // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
        DateTime myDT = new DateTime(2002, 4, 3, new GregorianCalendar());

        // Creates an instance of the JulianCalendar.
        JulianCalendar myCal = new JulianCalendar();

        // Displays the values of the DateTime.
        Console.WriteLine("April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:");
        DisplayValues(myCal, myDT);

        // Adds two years and ten months.
        myDT = myCal.AddYears(myDT, 2);
        myDT = myCal.AddMonths(myDT, 10);

        // Displays the values of the DateTime.
        Console.WriteLine("After adding two years and ten months:");
        DisplayValues(myCal, myDT);
    }