TimeZoneInfo.Local 속성

정의

현지 표준 시간대를 나타내는 TimeZoneInfo 개체를 가져옵니다.

public:
 static property TimeZoneInfo ^ Local { TimeZoneInfo ^ get(); };
public static TimeZoneInfo Local { get; }
public static TimeZoneInfo Local { [System.Security.SecurityCritical] get; }
member this.Local : TimeZoneInfo
[<get: System.Security.SecurityCritical>]
member this.Local : TimeZoneInfo
Public Shared ReadOnly Property Local As TimeZoneInfo

속성 값

TimeZoneInfo

현지 표준 시간대를 나타내는 개체입니다.

특성

예제

다음 예제에서는 현지 표준 시간대를 나타내는 개체를 검색 TimeZoneInfo 하고 표시 이름, 표준 시간 이름 및 일광 절약 시간제를 출력합니다.

using System;

public class Example
{
   public static void Main()
   {
      TimeZoneInfo localZone = TimeZoneInfo.Local;
      Console.WriteLine("Local Time Zone ID: {0}", localZone.Id);
      Console.WriteLine("   Display Name is: {0}.", localZone.DisplayName);
      Console.WriteLine("   Standard name is: {0}.", localZone.StandardName);
      Console.WriteLine("   Daylight saving name is: {0}.", localZone.DaylightName); 
   }
}
// The example displays output like the following:
//     Local Time Zone ID: Pacific Standard Time
//        Display Name is: (UTC-08:00) Pacific Time (US & Canada).
//        Standard name is: Pacific Standard Time.
//        Daylight saving name is: Pacific Daylight Time.
open System

let localZone = TimeZoneInfo.Local
printfn $"Local Time Zone ID: {localZone.Id}"
printfn $"   Display Name is: {localZone.DisplayName}."
printfn $"   Standard name is: {localZone.StandardName}."
printfn $"   Daylight saving name is: {localZone.DaylightName}."
// The example displays output like the following:
//     Local Time Zone ID: Pacific Standard Time
//        Display Name is: (UTC-08:00) Pacific Time (US & Canada).
//        Standard name is: Pacific Standard Time.
//        Daylight saving name is: Pacific Daylight Time.
Module Example
   Public Sub Main()
      Dim localZone As TimeZoneInfo = TimeZoneInfo.Local
      Console.WriteLine("Local Time Zone ID: {0}", localZone.Id)
      Console.WriteLine("   Display Name is: {0}.", localZone.DisplayName)
      Console.WriteLine("   Standard name is: {0}.", localZone.StandardName)
      Console.WriteLine("   Daylight saving name is: {0}.", localZone.DaylightName) 
   End Sub
End Module
' The example displays output like the following:
'     Local Time Zone ID: Pacific Standard Time
'        Display Name is: (UTC-08:00) Pacific Time (US & Canada).
'        Standard name is: Pacific Standard Time.
'        Daylight saving name is: Pacific Daylight Time.

설명

로컬 표준 시간대는 코드가 실행되는 컴퓨터의 표준 시간대입니다.

중요

개체 변수에 로컬 표준 시간대를 TimeZoneInfo.Local 할당하는 대신 속성을 통해 항상 로컬 표준 시간대에 TimeZoneInfo 액세스해야 합니다. 이렇게 하면 메서드 호출로 TimeZoneInfo 인해 개체 변수가 ClearCachedData 무효화되지 않습니다.

Windows 시스템에서 합니다 TimeZoneInfo 에서 반환 된 개체를 TimeZoneInfo.Local 속성 설정을 반영 합니다 일광 절약 시간제 시계를 자동으로 조정할 제어판에서 확인란을 날짜 및 시간 애플리케이션입니다. 확인란을 선택 취소하면 현지 표준 시간대의 캐시된 복사본에 일광 절약 시간제 정보가 포함되지 않습니다. 이는 다음을 의미합니다.

그러나 메서드를 사용하여 FindSystemTimeZoneById 현지 표준 시간대에 대한 참조를 검색하는 경우에는 그렇지 않습니다.

속성은 Local 클래스의 CurrentTimeZone 속성에 해당합니다 TimeZone .

적용 대상

추가 정보