Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​TimeZoneInfo
Assembly: System.Runtime
Inheritance: object → TimeZoneInfo
Represents any time zone in the world.
Properties
public
TimeSpan
BaseUtcOffset
Gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).
public
string
DaylightName
Gets the display name for the current time zone's daylight saving time.
public
string
DisplayName
Gets the general display name that represents the time zone.
public
bool
HasIanaId
Returns <see langword="true" /> if this TimeZoneInfo object has an IANA ID.
public
string
Id
Gets the time zone identifier.
public
string
StandardName
Gets the display name for the time zone's standard time.
public
bool
SupportsDaylightSavingTime
Gets a value indicating whether the time zone has any daylight saving time rules.
Methods
public
bool
Equals​(object obj)
obj
A second object to compare with the current object.
Returns <see langword="true" /> if <paramref name="obj" /> is a <see cref="T:System.TimeZoneInfo" /> object that is equal to the current instance; otherwise, <see langword="false" /> .
Determines whether the current <see cref="T:System.TimeZoneInfo" /> object and another object are equal.
public
bool
Equals​(TimeZoneInfo other)
other
A second object to compare with the current object.
Returns <see langword="true" /> if the two <see cref="T:System.TimeZoneInfo" /> objects are equal; otherwise, <see langword="false" /> .
Determines whether the current <see cref="T:System.TimeZoneInfo" /> object and another <see cref="T:System.TimeZoneInfo" /> object are equal.
public
AdjustmentRule[]
GetAdjustmentRules​() Returns An array of objects for this time zone.
Retrieves an array of <see cref="T:System.TimeZoneInfo.AdjustmentRule" /> objects that apply to the current <see cref="T:System.TimeZoneInfo" /> object.
public
TimeSpan[]
GetAmbiguousTimeOffsets​(DateTime dateTime)
dateTime
A date and time.
Returns An array of objects that represents possible Coordinated Universal Time (UTC) offsets that a particular date and time can be mapped to.
Returns information about the possible dates and times that an ambiguous date and time can be mapped to.
public
TimeSpan[]
GetAmbiguousTimeOffsets​(DateTimeOffset dateTimeOffset)
dateTimeOffset
A date and time.
Returns An array of objects that represents possible Coordinated Universal Time (UTC) offsets that a particular date and time can be mapped to.
Returns information about the possible dates and times that an ambiguous date and time can be mapped to.
public
int
GetHashCode​() Returns A 32-bit signed integer that serves as the hash code for this <see cref="T:System.TimeZoneInfo" /> object.
Serves as a hash function for hashing algorithms and data structures such as hash tables.
public
TimeSpan
GetUtcOffset​(DateTime dateTime)
dateTime
The date and time to determine the offset for.
Returns An object that indicates the time difference between the two time zones.
Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.
public
TimeSpan
GetUtcOffset​(DateTimeOffset dateTimeOffset)
dateTimeOffset
The date and time to determine the offset for.
Returns An object that indicates the time difference between Coordinated Universal Time (UTC) and the current time zone.
Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.
public
bool
HasSameRules​(TimeZoneInfo other)
other
A second object to compare with the current <see cref="T:System.TimeZoneInfo" /> object.
Returns <see langword="true" /> if the two time zones have identical adjustment rules and an identical base offset; otherwise, <see langword="false" /> .
Indicates whether the current object and another <see cref="T:System.TimeZoneInfo" /> object have the same adjustment rules.
public
bool
IsAmbiguousTime​(DateTime dateTime)
dateTime
A date and time value.
Returns <see langword="true" /> if the <paramref name="dateTime" /> parameter is ambiguous; otherwise, <see langword="false" /> .
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
bool
IsAmbiguousTime​(DateTimeOffset dateTimeOffset)
dateTimeOffset
A date and time.
Returns <see langword="true" /> if the <paramref name="dateTimeOffset" /> parameter is ambiguous in the current time zone; otherwise, <see langword="false" /> .
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
bool
IsDaylightSavingTime​(DateTime dateTime)
dateTime
A date and time value.
Returns <see langword="true" /> if the <paramref name="dateTime" /> parameter is a daylight saving time; otherwise, <see langword="false" /> .
Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current <see cref="T:System.TimeZoneInfo" /> object.
public
bool
IsDaylightSavingTime​(DateTimeOffset dateTimeOffset)
dateTimeOffset
A date and time value.
Returns <see langword="true" /> if the <paramref name="dateTimeOffset" /> parameter is a daylight saving time; otherwise, <see langword="false" /> .
Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current <see cref="T:System.TimeZoneInfo" /> object.
public
bool
IsInvalidTime​(DateTime dateTime)
dateTime
A date and time value.
Returns <see langword="true" /> if <paramref name="dateTime" /> is invalid; otherwise, <see langword="false" /> .
Indicates whether a particular date and time is invalid.
public
string
ToSerializedString​() Returns A string that represents the current <see cref="T:System.TimeZoneInfo" /> object.
Converts the current <see cref="T:System.TimeZoneInfo" /> object to a serialized string.
public
string
ToString​() Returns The value of the <see cref="P:System.TimeZoneInfo.DisplayName" /> property of the current <see cref="T:System.TimeZoneInfo" /> object.
Returns the current <see cref="T:System.TimeZoneInfo" /> object's display name.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .