TimeZoneInfo.StandardName 属性
定义
获取时区的标准时间的显示名称。Gets the display name for the time zone's standard time.
public:
property System::String ^ StandardName { System::String ^ get(); };
public string StandardName { get; }
member this.StandardName : string
Public ReadOnly Property StandardName As String
属性值
时区的标准时间的显示名称。The display name of the time zone's standard time.
示例
下面的示例定义了一个名为 DisplayDateWithTimeZoneName 的方法,该方法使用 IsDaylightSavingTime(DateTime) 方法来确定是显示时区的标准时间名称还是夏时制名称。The following example defines a method named DisplayDateWithTimeZoneName that uses the IsDaylightSavingTime(DateTime) method to determine whether to display a time zone's standard time name or daylight saving time name.
private void DisplayDateWithTimeZoneName(DateTime date1, TimeZoneInfo timeZone)
{
Console.WriteLine("The time is {0:t} on {0:d} {1}",
date1,
timeZone.IsDaylightSavingTime(date1) ?
timeZone.DaylightName : timeZone.StandardName);
}
// The example displays output similar to the following:
// The time is 1:00 AM on 4/2/2006 Pacific Standard Time
Private Sub DisplayDateWithTimeZoneName(date1 As Date, timeZone As TimeZoneInfo)
Console.WriteLine("The time is {0:t} on {0:d} {1}", _
date1, _
IIf(timeZone.IsDaylightSavingTime(date1), _
timezone.DaylightName, timezone.StandardName))
End Sub
' The example displays output similar to the following:
' The time is 1:00 AM on 4/2/2006 Pacific Standard Time
注解
显示名称根据 Windows 操作系统中安装的区域性进行了本地化。The display name is localized based on the culture installed with the Windows operating system.
StandardName属性与类的属性完全相同 StandardName TimeZone 。The StandardName property is identical to the StandardName property of the TimeZone class.
如果操作系统语言为英语,则属性的值 StandardName 通常(但不总是)与属性的值相同 Id 。If the operating system language is English, the value of the StandardName property is usually, but not always, identical to that of the Id property.