Editare

Partajați prin


TimeZoneInfo.Utc Property

Definition

Gets a TimeZoneInfo object that represents the Coordinated Universal Time (UTC) zone.

public:
 static property TimeZoneInfo ^ Utc { TimeZoneInfo ^ get(); };
public static TimeZoneInfo Utc { get; }
static member Utc : TimeZoneInfo
Public Shared ReadOnly Property Utc As TimeZoneInfo

Property Value

An object that represents the Coordinated Universal Time (UTC) zone.

Examples

The following example retrieves a TimeZoneInfo object that represents Coordinated Universal Time (UTC) and outputs its display name, standard time name, and daylight saving time name.

TimeZoneInfo universalZone = TimeZoneInfo.Utc;
Console.WriteLine("The universal time zone is {0}.", universalZone.DisplayName);
Console.WriteLine("Its standard name is {0}.", universalZone.StandardName);
Console.WriteLine("Its daylight savings name is {0}.", universalZone.DaylightName);
let universalZone = TimeZoneInfo.Utc
printfn $"The universal time zone is {universalZone.DisplayName}."
printfn $"Its standard name is {universalZone.StandardName}."
printfn $"Its daylight savings name is {universalZone.DaylightName}."
Dim universalZone As TimeZoneInfo = TimeZoneInfo.Utc
Console.WriteLine("The universal time zone is {0}.", universalZone.DisplayName)
Console.WriteLine("Its standard name is {0}.", universalZone.StandardName)
Console.WriteLine("Its daylight savings name is {0}.", universalZone.DaylightName)

Remarks

This is a built-in object; information about this TimeZoneInfo object is not retrieved from the registry on Windows systems and from the ICU Library on Linux and macOS.

Important

You should always access the Coordinated Universal Time (UTC) zone through the TimeZoneInfo.Utc property rather than assigning the UTC time zone to a TimeZoneInfo object variable. This prevents the TimeZoneInfo object variable from being invalidated by a call to the ClearCachedData method.

Coordinated Universal Time was previously known as Greenwich Mean Time (GMT).

Applies to

See also