TimeZoneInfo.Id 속성

정의

표준 시간대 식별자를 가져옵니다.

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

속성 값

표준 시간대 식별자입니다.

예제

다음 예제에서는 로컬 컴퓨터에 정의된 각 표준 시간대의 식별자를 나열합니다.

ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();
Console.WriteLine("The local system has the following {0} time zones", zones.Count);
foreach (TimeZoneInfo zone in zones)
   Console.WriteLine(zone.Id);
let zones = TimeZoneInfo.GetSystemTimeZones()
printfn $"The local system has the following {zones.Count} time zones"
for zone in zones do
    printfn $"{zone.Id}"
Dim zones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()
Console.WriteLine("The local system has the following {0} time zones", zones.Count)
For Each zone As TimeZoneInfo In zones
   Console.WriteLine(zone.Id)
Next

설명

표준 시간대 식별자는 특정 표준 시간대를 고유하게 식별하는 키 문자열입니다. Windows 시스템에서는 Windows 시스템 및 Linux 및 macOS의 ICU 라이브러리 에서 레지스트리의 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zone 분기의 하위 키에 해당합니다. 메서드에 매개 변수 FindSystemTimeZoneById 로 전달하여 특정 표준 시간대를 나타내는 개체를 TimeZoneInfo 인스턴스화할 수 있습니다.

중요

Windows 레지스트리의 키 이름은 최대 255자일 수 있지만 사용자 지정 표준 시간대에 할당하는 식별자는 32자 이하인 것이 좋습니다. 식별자가 길수록 검색할 때 잘못된 키 이름이 제공될 확률이 높아질 수 있습니다.

속성의 Id 값은 일반적으로 속성의 값과 동일하지만 항상 그렇지는 StandardName 않습니다. 협정 세계 표준 시간대의 식별자는 UTC입니다.

적용 대상