Export (0) Print
Expand All

HijriCalendar.MaxSupportedDateTime Property

Note: This property is new in the .NET Framework version 2.0.

Gets the latest date and time supported by this calendar.

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)

[ComVisibleAttribute(false)] 
public override DateTime MaxSupportedDateTime { get; }
/** @property */
public DateTime get_MaxSupportedDateTime ()

public override function get MaxSupportedDateTime () : DateTime

Property Value

The latest date and time supported by the HijriCalendar type, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.

December 31, 9999 C.E. is equivalent to the 3rd day of the 4th month of the year 9666 in the Hijri calendar.

The following code example gets the minimum value and the maximum value of the calendar.

using System;
using System.Globalization;


public class SamplesCalendar  {

   public static void Main()  {

      // Create an instance of the calendar.
      HijriCalendar myCal = new HijriCalendar();
      Console.WriteLine( myCal.ToString() );

      // Create an instance of the GregorianCalendar.
      GregorianCalendar myGre = new GregorianCalendar();

      // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
      DateTime myMin = myCal.MinSupportedDateTime;
      Console.Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin) );
      Console.WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMin), myGre.GetDayOfMonth(myMin), myGre.GetYear(myMin) );

      // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
      DateTime myMax = myCal.MaxSupportedDateTime;
      Console.Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax) );
      Console.WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMax), myGre.GetDayOfMonth(myMax), myGre.GetYear(myMax) );

   }

}


/*
This code produces the following output.

System.Globalization.HijriCalendar
MinSupportedDateTime: 01/01/0001 (in Gregorian, 07/18/0622)
MaxSupportedDateTime: 04/03/9666 (in Gregorian, 12/31/9999)

*/

import System.*;
import System.Globalization.*;

public class SamplesCalendar
{   
    public static void main(String[] args)
    {
        // Create an instance of the calendar.
        HijriCalendar myCal =  new HijriCalendar();
        Console.WriteLine(myCal.ToString());

        // Create an instance of the GregorianCalendar.
        GregorianCalendar myGre =  new GregorianCalendar();

        // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
        DateTime myMin = myCal.get_MinSupportedDateTime();
        Console.Write("MinSupportedDateTime: {0}/{1}/{2}",
            ((System.Int32)myCal.GetMonth(myMin)).ToString("D2"),
            ((System.Int32)myCal.GetDayOfMonth(myMin)).ToString("D2"),
            ((System.Int32)myCal.GetYear(myMin)).ToString("D4"));
        Console.WriteLine(" (in Gregorian, {0}/{1}/{2})",
            ((System.Int32)myGre.GetMonth(myMin)).ToString("D2"),
            ((System.Int32)myGre.GetDayOfMonth(myMin)).ToString("D2"),
            ((System.Int32)myGre.GetYear(myMin)).ToString("D4"));

        // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
        DateTime myMax = myCal.get_MaxSupportedDateTime();
        Console.Write("MaxSupportedDateTime: {0}/{1}/{2}",
            ((System.Int32)myCal.GetMonth(myMax)).ToString("D2"),
            ((System.Int32)myCal.GetDayOfMonth(myMax)).ToString("D2"),
            ((System.Int32)myCal.GetYear(myMax)).ToString("D4"));
        Console.WriteLine(" (in Gregorian, {0}/{1}/{2})",
            ((System.Int32)myGre.GetMonth(myMax)).ToString("D2"),
            ((System.Int32)myGre.GetDayOfMonth(myMax)).ToString("D2"),
            ((System.Int32)myGre.GetYear(myMax)).ToString("D4"));
    } //main 
} //SamplesCalendar

/*
This code produces the following output.

System.Globalization.HijriCalendar
MinSupportedDateTime: 01/01/0001 (in Gregorian, 07/18/0622)
MaxSupportedDateTime: 04/03/9666 (in Gregorian, 12/31/9999)

*/

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft