TimeZoneInfo.StandardName 属性

定义

获取时区的标准时间的显示名称。

public:
 property System::String ^ StandardName { System::String ^ get(); };
public string StandardName { get; }
member this.StandardName : string
Public ReadOnly Property StandardName As String

属性值

String

时区的标准时间的显示名称。

示例

以下示例定义一个名为的方法 DisplayDateWithTimeZoneName ,该方法使用 IsDaylightSavingTime(DateTime) 该方法来确定是显示时区的标准时间名称还是夏令时名称。

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
let displayDateWithTimeZoneName (date1: DateTime) (timeZone: TimeZoneInfo) =
    printfn $"The time is {date1:t} on {date1:d} {if timeZone.IsDaylightSavingTime date1 then timeZone.DaylightName else 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操作系统一起安装的区域性进行本地化。

StandardName 属性与 StandardName 类的属性 TimeZone 相同。

如果操作系统语言为英语,则属性的值 StandardName 通常与属性的值相同,但并非始终相同 Id

适用于