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.​TimeZone

Assembly: System.Runtime

Inheritance: object → TimeZone

Represents a time zone.

Properties

public static TimeZone
CurrentTimeZone
Gets the time zone of the current computer.
public string
DaylightName
Gets the daylight saving time zone name.
public string
StandardName
Gets the standard time zone name.

Methods

public DaylightTime
GetDaylightChanges​(int year)
Returns the daylight saving time period for a particular year.
Returns A <see cref="T:System.Globalization.DaylightTime" /> object that contains the start and end date for daylight saving time in <paramref name="year" /> .
year The year that the daylight saving time period applies to.
public TimeSpan
GetUtcOffset​(DateTime time)
Returns the Coordinated Universal Time (UTC) offset for the specified local time.
Returns The Coordinated Universal Time (UTC) offset from <paramref name="time" /> .
time A date and time value.
public bool
IsDaylightSavingTime​(DateTime time)
Returns a value indicating whether the specified date and time is within a daylight saving time period.
Returns <see langword="true" /> if <paramref name="time" /> is in a daylight saving time period; otherwise, <see langword="false" /> .
time A date and time.
public static bool
IsDaylightSavingTime​(DateTime time, DaylightTime daylightTimes)
Returns a value indicating whether the specified date and time is within the specified daylight saving time period.
Returns <see langword="true" /> if <paramref name="time" /> is in <paramref name="daylightTimes" /> ; otherwise, <see langword="false" /> .
time A date and time.
daylightTimes A daylight saving time period.
public DateTime
ToLocalTime​(DateTime time)
Returns the local time that corresponds to a specified date and time value.
Returns A <see cref="T:System.DateTime" /> object whose value is the local time that corresponds to <paramref name="time" /> .
time A Coordinated Universal Time (UTC) time.
public DateTime
ToUniversalTime​(DateTime time)
Returns the Coordinated Universal Time (UTC) that corresponds to a specified time.
Returns A <see cref="T:System.DateTime" /> object whose value is the Coordinated Universal Time (UTC) that corresponds to <paramref name="time" /> .
time A date and time.
public bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
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 int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.