MinSupportedDateTime Property
Collapse the table of content
Expand the table of content

GregorianCalendar.MinSupportedDateTime Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets the earliest date and time supported by the GregorianCalendar type.

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

public override DateTime MinSupportedDateTime { get; }

Property Value

Type: System.DateTime
The earliest date and time supported by the GregorianCalendar type, which is the first moment of January 1, 0001 C.E. and is equivalent to MinValue.

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


using System;
using System.Globalization;


public class Example
{

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

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

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

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

   }

}


/*
This code produces the following output.

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

*/


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft