GregorianCalendar.MinSupportedDateTime Proprietà

Definizione

Ottiene la data e l'ora meno recenti supportate dal tipo GregorianCalendar.

C#
public override DateTime MinSupportedDateTime { get; }
C#
[System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime { get; }

Valore della proprietà

La data e l'ora più antiche supportate dal GregorianCalendar tipo, ovvero il primo momento del 1° gennaio 0001 C.E. ed è equivalente a DateTime.MinValue.

Attributi

Esempio

L'esempio di codice seguente ottiene il valore minimo e il valore massimo del calendario.

C#
using System;
using System.Globalization;

public class SamplesCalendar  {

   public static void Main()  {

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

      // Display the MinSupportedDateTime.
      DateTime myMin = myCal.MinSupportedDateTime;
      Console.WriteLine( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin) );

      // Display the MaxSupportedDateTime.
      DateTime myMax = myCal.MaxSupportedDateTime;
      Console.WriteLine( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax) );
   }
}


/*
This code produces the following output.

System.Globalization.GregorianCalendar
MinSupportedDateTime: 01/01/0001
MaxSupportedDateTime: 12/31/9999

*/

Commenti

Anche se il valore della MinSupportedDateTime proprietà è il primo momento del 1° gennaio 0001 C.E., il calendario gregoriano non è stato introdotto fino al 15 ottobre 1582 e la sua adozione in tutto il continente europeo e in tutto il mondo è stato lento. Finché non adottarono il calendario gregoriano, la maggior parte delle culture nei continenti europei, americani e australiani utilizzò il calendario julian, rappresentato dalla JulianCalendar classe .

Si applica a

Prodotto Versioni
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0