GregorianCalendar.MinSupportedDateTime 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 GregorianCalendar 类型支持的最早日期和时间。
public:
virtual property DateTime MinSupportedDateTime { DateTime get(); };
public override DateTime MinSupportedDateTime { get; }
[System.Runtime.InteropServices.ComVisible(false)]
public override DateTime MinSupportedDateTime { get; }
member this.MinSupportedDateTime : DateTime
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.MinSupportedDateTime : DateTime
Public Overrides ReadOnly Property MinSupportedDateTime As DateTime
属性值
类型支持的 GregorianCalendar 最早日期和时间,即 C.E. 0001 年 1 月 1 日的第一个时刻,等效于 DateTime.MinValue。
- 属性
示例
下面的代码示例获取日历的最小值和最大值。
using namespace System;
using namespace System::Globalization;
int main()
{
// Create an instance of the calendar.
GregorianCalendar^ myCal = gcnew GregorianCalendar;
Console::WriteLine( myCal );
// 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
*/
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
*/
Imports System.Globalization
Public Class SamplesCalendar
Public Shared Sub Main()
' Create an instance of the calendar.
Dim myCal As New GregorianCalendar()
Console.WriteLine(myCal.ToString())
' Display the MinSupportedDateTime.
Dim myMin As DateTime = myCal.MinSupportedDateTime
Console.WriteLine("MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMin), myCal.GetDayOfMonth(myMin), myCal.GetYear(myMin))
' Display the MaxSupportedDateTime.
Dim myMax As DateTime = myCal.MaxSupportedDateTime
Console.WriteLine("MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal.GetMonth(myMax), myCal.GetDayOfMonth(myMax), myCal.GetYear(myMax))
End Sub
End Class
'This code produces the following output.
'
'System.Globalization.GregorianCalendar
'MinSupportedDateTime: 01/01/0001
'MaxSupportedDateTime: 12/31/9999
注解
虽然该财产的价值 MinSupportedDateTime 是C.E.0001年1月1日的第一个时刻,但公历直到1582年10月15日才引入,在整个欧洲大陆和全世界采用公历的速度很慢。 在他们采用公历之前,欧洲、美洲和澳大利亚大陆的大多数文化都使用以 类表示的 JulianCalendar 朱利安历。