CultureInfo.Calendar Property

Definition

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

public:
 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

Property Value

Calendar

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

Remarks

用户可以选择通过 "控制面板" 的 "区域和语言选项" 部分,替代与 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.

如果 UseUserOverride true 并且指定的区域性与 Windows 的当前区域性匹配,则 CultureInfo 将使用这些重写,其中包括 DateTimeFormat 属性返回的 DateTimeFormatInfo 实例的属性的用户设置,以及 NumberFormatInfo 属性返回的 NumberFormat 实例的属性。If 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.

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

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

Applies to

See also