CultureInfo.Calendar 属性


获取区域性使用的默认日历。Gets the default calendar used by the culture.

 virtual property System::Globalization::Calendar ^ Calendar { System::Globalization::Calendar ^ get(); };
public virtual System.Globalization.Calendar Calendar { get; }
member this.Calendar : System.Globalization.Calendar
Public Overridable ReadOnly Property Calendar As Calendar



表示区域性使用的默认日历的 CalendarA Calendar that represents the default calendar used by the culture.


用户可以选择通过 "控制面板" 的 "区域和语言选项" 部分,替代与 Windows 的当前区域性关联的某些值。The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. 例如,用户可以选择以不同的格式显示日期,或使用区域性默认值以外的其他货币。For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture.

如果 UseUserOverridetrue ,并且指定的区域性与 Windows 的当前区域性匹配,则将 CultureInfo 使用这些重写,包括属性返回的实例的属性的用户设置 DateTimeFormatInfo DateTimeFormat ,以及 NumberFormatInfo 由属性返回的实例的属性 NumberFormatIf UseUserOverride is true and the specified culture matches the current culture of Windows, the CultureInfo uses those overrides, including user settings for the properties of the DateTimeFormatInfo instance returned by the DateTimeFormat property, and the properties of the NumberFormatInfo instance returned by the NumberFormat property. 如果用户设置与关联的区域性不兼容 CultureInfo (例如,如果所选的日历不是 OptionalCalendars ),则方法的结果和属性的值是不确定的。If the user settings are incompatible with the culture associated with the CultureInfo, for example, if the selected calendar is not one of the OptionalCalendars, the results of the methods and the values of the properties are undefined.

因此,如果 UseUserOverridetrue ,则此属性的值可能与区域性使用的默认日历不同。Therefore, if UseUserOverride is true, the value of this property might be different from the default calendar used by the culture.

应用程序 CultureInfo 通过设置的 Calendar 属性 DateTimeFormat (类的实例)更改当前使用的日历 DateTimeFormatInfoYour application changes the calendar used by the current CultureInfo by setting the Calendar property of DateTimeFormat, which is an instance of the DateTimeFormatInfo class. 新日历必须是中列出的其中一个日历 OptionalCalendarsThe new calendar must be one of the calendars listed in OptionalCalendars. DateTimeFormat 还包括一些自定义与该关联的日期和时间格式设置的属性 CalendarDateTimeFormat also includes other properties that customize the date and time formatting associated with that Calendar.