HebrewCalendar.MinSupportedDateTime 屬性

定義

取得 HebrewCalendar 型別所支援的最早日期和時間。

public:
 virtual property DateTime MinSupportedDateTime { DateTime get(); };
public override DateTime MinSupportedDateTime { get; }
member this.MinSupportedDateTime : DateTime
Public Overrides ReadOnly Property MinSupportedDateTime As DateTime

屬性值

類型所 HebrewCalendar 支援的最早日期和時間,相當於公曆中的 1583 年 1 月 1 日 C.E. 第一刻。

範例

下列程式代碼範例會取得行事曆的最小值和最大值。

using namespace System;
using namespace System::Globalization;

int main()
{
   // Create an instance of the calendar.
   HebrewCalendar^ myCal = gcnew HebrewCalendar;
   Console::WriteLine( myCal );
   
   // Create an instance of the GregorianCalendar.
   GregorianCalendar^ myGre = gcnew 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.HebrewCalendar
MinSupportedDateTime: 04/07/5343 (in Gregorian, 01/01/1583)
MaxSupportedDateTime: 13/29/5999 (in Gregorian, 09/29/2239)

*/
using System;
using System.Globalization;

public class SamplesCalendar  {

   public static void Main()  {

      // Create an instance of the calendar.
      HebrewCalendar myCal = new HebrewCalendar();
      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.HebrewCalendar
MinSupportedDateTime: 04/07/5343 (in Gregorian, 01/01/1583)
MaxSupportedDateTime: 13/29/5999 (in Gregorian, 09/29/2239)

*/
Imports System.Globalization

Public Class SamplesCalendar   

   Public Shared Sub Main()

      ' Create an instance of the calendar.
      Dim myCal As New HebrewCalendar()
      Console.WriteLine(myCal.ToString())

      ' 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
      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.
      Dim myMax As DateTime = 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))

   End Sub

End Class


'This code produces the following output.
'
'System.Globalization.HebrewCalendar
'MinSupportedDateTime: 04/07/5343 (in Gregorian, 01/01/1583)
'MaxSupportedDateTime: 13/29/5999 (in Gregorian, 09/29/2239)

備註

Microsoft Visual Basic 會將一天的時間表示為類型所支援 DateTime 之最小日期的指定時間,也就是 0001 年 1 月 1 日 C.E。不過, HebrewCalendar 類型不支援該最小日期。 因此,如果您使用目前的行事曆呼叫方法來格式化日期時間,但未指定格式規範,則格式會使用 ISO 8601 可排序 (“s”) 日期/時間模式格式規範,而不是預設的一般 (“G”) 日期/時間模式格式規範。 如需詳細資訊,請參閱 標準日期和時間格式字串

適用於