This topic has not yet been rated - Rate this topic

TimeZoneInfo Class

April 12, 2014

Represents a time zone.

System.Object
  System.TimeZoneInfo

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)
public sealed class TimeZoneInfo : IEquatable<TimeZoneInfo>

The TimeZoneInfo type exposes the following members.

  NameDescription
Public propertyBaseUtcOffsetGets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).
Public propertyDaylightNameGets the localized display name for the current time zone's daylight saving time.
Public propertyDisplayNameGets the localized general display name that represents the time zone.
Public propertyStatic memberLocalGets a TimeZoneInfo object that represents the local time zone.
Public propertyStandardNameGets the localized display name for the time zone's standard time.
Public propertySupportsDaylightSavingTimeGets a value indicating whether the time zone has any daylight saving time rules.
Public propertyStatic memberUtcGets a TimeZoneInfo object that represents the Coordinated Universal Time (UTC) zone.
Top
  NameDescription
Public methodStatic memberConvertTime(DateTime, TimeZoneInfo)Converts a time to the time in a particular time zone.
Public methodStatic memberConvertTime(DateTimeOffset, TimeZoneInfo)Converts a time to the time in a particular time zone.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodEquals(TimeZoneInfo)Determines whether the current TimeZoneInfo object and another TimeZoneInfo object are equal.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAmbiguousTimeOffsets(DateTime)Returns information about the possible dates and times that an ambiguous date and time can be mapped to.
Public methodGetAmbiguousTimeOffsets(DateTimeOffset)Returns information about the possible dates and times that an ambiguous date and time can be mapped to.
Public methodGetHashCodeServes as a hash function for hashing algorithms and data structures such as hash tables. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetUtcOffset(DateTime)Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.
Public methodGetUtcOffset(DateTimeOffset)Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.
Public methodIsAmbiguousTime(DateTime)Determines whether a particular date and time in a particular time zone is ambiguous and can be mapped to two or more Coordinated Universal Time (UTC) times.
Public methodIsAmbiguousTime(DateTimeOffset)Determines whether a particular date and time in a particular time zone is ambiguous and can be mapped to two or more Coordinated Universal Time (UTC) times.
Public methodIsDaylightSavingTime(DateTime)Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current TimeZoneInfo object.
Public methodIsDaylightSavingTime(DateTimeOffset)Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current TimeZoneInfo object.
Public methodIsInvalidTimeIndicates whether a particular date and time is invalid.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns the current TimeZoneInfo object's display name. (Overrides Object.ToString().)
Top

A time zone is a geographical region in which the same time is used. TimeZoneInfo is an immutable class that represents a time zone. It recognizes two predefined time zones:

  • The local time zone (the time zone of the system on which Windows Phone code is running). A TimeZoneInfo object that represents the local time zone can be retrieved from the TimeZoneInfo.Local property.

  • Coordinated Universal Time (UTC). A TimeZoneInfo object that represents UTC can be retrieved from the TimeZoneInfo.Utc property.

The TimeZoneInfo class includes the ConvertTime method, which allows conversions from the time in any time zone to either local time or UTC, or between the local time and UTC. It also offers a number of members that provide information about the time zone itself or about a particular time in that time zone.

You cannot instantiate a TimeZoneInfo object using the new keyword. Instead, you must retrieve the appropriate TimeZoneInfo object from either the Local property or the Utc property.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.