GregorianCalendar.MaxSupportedDateTime Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets the latest date and time supported by the GregorianCalendar type.
Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<ComVisibleAttribute(False)> _
Public Overrides ReadOnly Property MaxSupportedDateTime As DateTime
[ComVisibleAttribute(false)]
public override DateTime MaxSupportedDateTime { get; }
Property Value
Type: System.DateTime
The latest date and time supported by the GregorianCalendar type, which is the last moment of December 31, 9999 C.E. and is equivalent to MaxValue.
Examples
The following example gets the minimum value and the maximum value of the GregorianCalendar 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 GregorianCalendar()
outputBlock.Text &= myCal.ToString() & vbCrLf
' Display the MinSupportedDateTime.
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)) & vbCrLf
' Display the MaxSupportedDateTime.
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)) & vbCrLf
End Sub 'Main
End Class 'SamplesCalendar
'This code produces the following output.
'
'System.Globalization.GregorianCalendar
'MinSupportedDateTime: 01/01/0001
'MaxSupportedDateTime: 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.
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
*/
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.