다음을 통해 공유


HijriCalendar.MinSupportedDateTime Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the earliest date and time supported by this calendar.

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

Syntax

'Declaration
<ComVisibleAttribute(False)> _
Public Overrides ReadOnly Property MinSupportedDateTime As DateTime
[ComVisibleAttribute(false)]
public override DateTime MinSupportedDateTime { get; }

Property Value

Type: System.DateTime
The earliest date and time supported by the HijriCalendar type, which is equivalent to the first moment of July 18, 622 C.E. in the Gregorian calendar.

Remarks

Microsoft Visual Basic represents time of day as the specified time on the minimum date supported by the DateTime type, which is January 1, 0001 C.E. However, the HijriCalendar type does not support that minimum date. Consequently, if you call a method to format the time of day using the current calendar but you do not specify a format specifier, formatting uses the ISO 8601 sortable ("s") date/time pattern format specifier instead of the default general ("G") date/time pattern format specifier. For more information, see Standard Date and Time Format Strings.

Examples

The following example gets the minimum value and the maximum value of the HijriCalendar class.

Imports System.Globalization

Public Class Example

   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

      ' Create an instance of the calendar.
      Dim myCal As New HijriCalendar()
      outputBlock.Text &= myCal.ToString() & vbCrLf

      ' Create an instance of the GregorianCalendar.
      Dim myGre As New GregorianCalendar()

      ' Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
      Dim myMin As DateTime = myCal.MinSupportedDateTime
      outputBlock.Text += String.Format("MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin))
      outputBlock.Text += String.Format(" (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMin), myGre.GetDayOfMonth(myMin), myGre.GetYear(myMin)) & vbCrLf

      ' Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
      Dim myMax As DateTime = myCal.MaxSupportedDateTime
      outputBlock.Text += String.Format("MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax))
      outputBlock.Text += String.Format(" (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMax), myGre.GetDayOfMonth(myMax), myGre.GetYear(myMax)) & vbCrLf

   End Sub 'Main 

End Class '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)

using System;
using System.Globalization;


public class Example
{

   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {

      // Create an instance of the calendar.
      HijriCalendar myCal = new HijriCalendar();
      outputBlock.Text += myCal.ToString() + "\n";

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

      // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar.
      DateTime myMin = myCal.MinSupportedDateTime;
      outputBlock.Text += String.Format("MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin));
      outputBlock.Text += String.Format(" (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMin), myGre.GetDayOfMonth(myMin), myGre.GetYear(myMin)) + "\n";

      // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar.
      DateTime myMax = myCal.MaxSupportedDateTime;
      outputBlock.Text += String.Format("MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax));
      outputBlock.Text += String.Format(" (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre.GetMonth(myMax), myGre.GetDayOfMonth(myMax), myGre.GetYear(myMax)) + "\n";

   }

}


/*
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)

*/

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.