mscorlib(4.0.0.0) API with additions
System.TimeZoneInfo Class Reference

Represents any time zone in the world. More...

Inheritance diagram for System.TimeZoneInfo:
[legend]
Collaboration diagram for System.TimeZoneInfo:
[legend]

Classes

class  AdjustmentRule
 Provides information about a time zone adjustment, such as the transition to and from daylight saving time. More...
 
struct  TransitionTime
 Provides information about a specific time change, such as the change from daylight saving time to standard time or vice versa, in a particular time zone. More...
 

Public Member Functions

AdjustmentRule [] GetAdjustmentRules ()
 Retrieves an array of T:System.TimeZoneInfo.AdjustmentRule objects that apply to the current T:System.TimeZoneInfo object. More...
 
TimeSpan [] GetAmbiguousTimeOffsets (DateTimeOffset dateTimeOffset)
 Returns information about the possible dates and times that an ambiguous date and time can be mapped to. More...
 
TimeSpan [] GetAmbiguousTimeOffsets (DateTime dateTime)
 Returns information about the possible dates and times that an ambiguous date and time can be mapped to. More...
 
TimeSpan GetUtcOffset (DateTimeOffset dateTimeOffset)
 Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time. More...
 
TimeSpan GetUtcOffset (DateTime dateTime)
 Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time. More...
 
bool IsAmbiguousTime (DateTimeOffset 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. More...
 
bool IsAmbiguousTime (DateTime 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. More...
 
bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset)
 Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current T:System.TimeZoneInfo object. More...
 
bool IsDaylightSavingTime (DateTime dateTime)
 Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current T:System.TimeZoneInfo object. More...
 
bool IsInvalidTime (DateTime dateTime)
 Indicates whether a particular date and time is invalid. More...
 
bool Equals (TimeZoneInfo other)
 Determines whether the current T:System.TimeZoneInfo object and another T:System.TimeZoneInfo object are equal. More...
 
override bool Equals (object obj)
 Determines whether the current T:System.TimeZoneInfo object and another object are equal. More...
 
override int GetHashCode ()
 Serves as a hash function for hashing algorithms and data structures such as hash tables. More...
 
bool HasSameRules (TimeZoneInfo other)
 Indicates whether the current object and another T:System.TimeZoneInfo object have the same adjustment rules. More...
 
string ToSerializedString ()
 Converts the current T:System.TimeZoneInfo object to a serialized string. More...
 
override string ToString ()
 Returns the current T:System.TimeZoneInfo object's display name. More...
 
- Public Member Functions inherited from System.IEquatable< TimeZoneInfo >
bool Equals (T other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static void ClearCachedData ()
 Clears cached time zone data. More...
 
static DateTimeOffset ConvertTimeBySystemTimeZoneId (DateTimeOffset dateTimeOffset, string destinationTimeZoneId)
 Converts a time to the time in another time zone based on the time zone's identifier. More...
 
static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string destinationTimeZoneId)
 Converts a time to the time in another time zone based on the time zone's identifier. More...
 
static DateTime ConvertTimeBySystemTimeZoneId (DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId)
 Converts a time from one time zone to another based on time zone identifiers. More...
 
static DateTimeOffset ConvertTime (DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone)
 Converts a time to the time in a particular time zone. More...
 
static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo destinationTimeZone)
 Converts a time to the time in a particular time zone. More...
 
static DateTime ConvertTime (DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone)
 Converts a time from one time zone to another. More...
 
static DateTime ConvertTimeFromUtc (DateTime dateTime, TimeZoneInfo destinationTimeZone)
 Converts a Coordinated Universal Time (UTC) to the time in a specified time zone. More...
 
static DateTime ConvertTimeToUtc (DateTime dateTime)
 Converts the specified date and time to Coordinated Universal Time (UTC). More...
 
static DateTime ConvertTimeToUtc (DateTime dateTime, TimeZoneInfo sourceTimeZone)
 Converts the time in a specified time zone to Coordinated Universal Time (UTC). More...
 
static TimeZoneInfo FromSerializedString (string source)
 Deserializes a string to re-create an original serialized T:System.TimeZoneInfo object. More...
 
static ReadOnlyCollection< TimeZoneInfoGetSystemTimeZones ()
 Returns a sorted collection of all the time zones about which information is available on the local system. More...
 
static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName)
 Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, and a standard time display name. More...
 
static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, AdjustmentRule[] adjustmentRules)
 Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, a standard time name, a daylight saving time name, and daylight saving time rules. More...
 
static TimeZoneInfo CreateCustomTimeZone (string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, AdjustmentRule[] adjustmentRules, bool disableDaylightSavingTime)
 Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, a standard time name, a daylight saving time name, daylight saving time rules, and a value that indicates whether the returned object reflects daylight saving time information. More...
 
static TimeZoneInfo FindSystemTimeZoneById (string id)
 Retrieves a T:System.TimeZoneInfo object from the registry based on its identifier. More...
 

Properties

string Id [get]
 Gets the time zone identifier. More...
 
string DisplayName [get]
 Gets the general display name that represents the time zone. More...
 
string StandardName [get]
 Gets the display name for the time zone's standard time. More...
 
string DaylightName [get]
 Gets the display name for the current time zone's daylight saving time. More...
 
TimeSpan BaseUtcOffset [get]
 Gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC). More...
 
bool SupportsDaylightSavingTime [get]
 Gets a value indicating whether the time zone has any daylight saving time rules. More...
 
static TimeZoneInfo Local [get]
 Gets a T:System.TimeZoneInfo object that represents the local time zone. More...
 
static TimeZoneInfo Utc [get]
 Gets a T:System.TimeZoneInfo object that represents the Coordinated Universal Time (UTC) zone. More...
 

Detailed Description

Represents any time zone in the world.

Definition at line 20 of file TimeZoneInfo.cs.

Member Function Documentation

◆ ClearCachedData()

static void System.TimeZoneInfo.ClearCachedData ( )
static

Clears cached time zone data.

Definition at line 1544 of file TimeZoneInfo.cs.

◆ ConvertTime() [1/3]

static DateTimeOffset System.TimeZoneInfo.ConvertTime ( DateTimeOffset  dateTimeOffset,
TimeZoneInfo  destinationTimeZone 
)
static

Converts a time to the time in a particular time zone.

Parameters
dateTimeOffsetThe date and time to convert.
destinationTimeZoneThe time zone to convert dateTime to.
Returns
The date and time in the destination time zone.
Exceptions
T:System.ArgumentNullExceptionThe value of the destinationTimeZone parameter is null.

Definition at line 1612 of file TimeZoneInfo.cs.

◆ ConvertTime() [2/3]

static DateTime System.TimeZoneInfo.ConvertTime ( DateTime  dateTime,
TimeZoneInfo  destinationTimeZone 
)
static

Converts a time to the time in a particular time zone.

Parameters
dateTimeThe date and time to convert.
destinationTimeZoneThe time zone to convert dateTime to.
Returns
The date and time in the destination time zone.
Exceptions
T:System.ArgumentExceptionThe value of the dateTime parameter represents an invalid time.
T:System.ArgumentNullExceptionThe value of the destinationTimeZone parameter is null.

Definition at line 1639 of file TimeZoneInfo.cs.

◆ ConvertTime() [3/3]

static DateTime System.TimeZoneInfo.ConvertTime ( DateTime  dateTime,
TimeZoneInfo  sourceTimeZone,
TimeZoneInfo  destinationTimeZone 
)
static

Converts a time from one time zone to another.

Parameters
dateTimeThe date and time to convert.
sourceTimeZoneThe time zone of dateTime .
destinationTimeZoneThe time zone to convert dateTime to.
Returns
The date and time in the destination time zone that corresponds to the dateTime parameter in the source time zone.
Exceptions
T:System.ArgumentExceptionThe P:System.DateTime.Kind property of the dateTime parameter is F:System.DateTimeKind.Local, but the sourceTimeZone parameter does not equal F:System.DateTimeKind.Local. For more information, see the Remarks section. -or-The P:System.DateTime.Kind property of the dateTime parameter is F:System.DateTimeKind.Utc, but the sourceTimeZone parameter does not equal P:System.TimeZoneInfo.Utc.-or-The dateTime parameter is an invalid time (that is, it represents a time that does not exist because of a time zone's adjustment rules).
T:System.ArgumentNullExceptionThe sourceTimeZone parameter is null.-or-The destinationTimeZone parameter is null.

Definition at line 1665 of file TimeZoneInfo.cs.

◆ ConvertTimeBySystemTimeZoneId() [1/3]

static DateTimeOffset System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId ( DateTimeOffset  dateTimeOffset,
string  destinationTimeZoneId 
)
static

Converts a time to the time in another time zone based on the time zone's identifier.

Parameters
dateTimeOffsetThe date and time to convert.
destinationTimeZoneIdThe identifier of the destination time zone.
Returns
The date and time in the destination time zone.
Exceptions
T:System.ArgumentNullExceptiondestinationTimeZoneId is null.
T:System.InvalidTimeZoneExceptionThe time zone identifier was found but the registry data is corrupted.
T:System.Security.SecurityExceptionThe process does not have the permissions required to read from the registry key that contains the time zone information.
T:System.TimeZoneNotFoundExceptionThe destinationTimeZoneId identifier was not found on the local system.

Definition at line 1558 of file TimeZoneInfo.cs.

◆ ConvertTimeBySystemTimeZoneId() [2/3]

static DateTime System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId ( DateTime  dateTime,
string  destinationTimeZoneId 
)
static

Converts a time to the time in another time zone based on the time zone's identifier.

Parameters
dateTimeThe date and time to convert.
destinationTimeZoneIdThe identifier of the destination time zone.
Returns
The date and time in the destination time zone.
Exceptions
T:System.ArgumentNullExceptiondestinationTimeZoneId is null.
T:System.InvalidTimeZoneExceptionThe time zone identifier was found, but the registry data is corrupted.
T:System.Security.SecurityExceptionThe process does not have the permissions required to read from the registry key that contains the time zone information.
T:System.TimeZoneNotFoundExceptionThe destinationTimeZoneId identifier was not found on the local system.

Definition at line 1572 of file TimeZoneInfo.cs.

◆ ConvertTimeBySystemTimeZoneId() [3/3]

static DateTime System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId ( DateTime  dateTime,
string  sourceTimeZoneId,
string  destinationTimeZoneId 
)
static

Converts a time from one time zone to another based on time zone identifiers.

Parameters
dateTimeThe date and time to convert.
sourceTimeZoneIdThe identifier of the source time zone.
destinationTimeZoneIdThe identifier of the destination time zone.
Returns
The date and time in the destination time zone that corresponds to the dateTime parameter in the source time zone.
Exceptions
T:System.ArgumentExceptionThe P:System.DateTime.Kind property of the dateTime parameter does not correspond to the source time zone.-or- dateTime is an invalid time in the source time zone.
T:System.ArgumentNullExceptionsourceTimeZoneId is null.-or- destinationTimeZoneId is null.
T:System.InvalidTimeZoneExceptionThe time zone identifiers were found, but the registry data is corrupted.
T:System.Security.SecurityExceptionThe process does not have the permissions required to read from the registry key that contains the time zone information.
T:System.TimeZoneNotFoundExceptionThe sourceTimeZoneId identifier was not found on the local system.-or-The destinationTimeZoneId identifier was not found on the local system.
T:System.Security.SecurityExceptionThe user does not have the permissions required to read from the registry keys that hold time zone data.

Definition at line 1591 of file TimeZoneInfo.cs.

◆ ConvertTimeFromUtc()

static DateTime System.TimeZoneInfo.ConvertTimeFromUtc ( DateTime  dateTime,
TimeZoneInfo  destinationTimeZone 
)
static

Converts a Coordinated Universal Time (UTC) to the time in a specified time zone.

Parameters
dateTimeThe Coordinated Universal Time (UTC).
destinationTimeZoneThe time zone to convert dateTime to.
Returns
The date and time in the destination time zone. Its P:System.DateTime.Kind property is F:System.DateTimeKind.Utc if destinationTimeZone is P:System.TimeZoneInfo.Utc; otherwise, its P:System.DateTime.Kind property is F:System.DateTimeKind.Unspecified.
Exceptions
T:System.ArgumentExceptionThe P:System.DateTime.Kind property of dateTime is F:System.DateTimeKind.Local.
T:System.ArgumentNullExceptiondestinationTimeZone is null.

Definition at line 1729 of file TimeZoneInfo.cs.

◆ ConvertTimeToUtc() [1/2]

static DateTime System.TimeZoneInfo.ConvertTimeToUtc ( DateTime  dateTime)
static

Converts the specified date and time to Coordinated Universal Time (UTC).

Parameters
dateTimeThe date and time to convert.
Returns
The Coordinated Universal Time (UTC) that corresponds to the dateTime parameter. The T:System.DateTime value's P:System.DateTime.Kind property is always set to F:System.DateTimeKind.Utc.
Exceptions
T:System.ArgumentExceptionTimeZoneInfo.Local.IsInvalidDateTime( dateTime ) returns true.

Definition at line 1742 of file TimeZoneInfo.cs.

◆ ConvertTimeToUtc() [2/2]

static DateTime System.TimeZoneInfo.ConvertTimeToUtc ( DateTime  dateTime,
TimeZoneInfo  sourceTimeZone 
)
static

Converts the time in a specified time zone to Coordinated Universal Time (UTC).

Parameters
dateTimeThe date and time to convert.
sourceTimeZoneThe time zone of dateTime .
Returns
The Coordinated Universal Time (UTC) that corresponds to the dateTime parameter. The T:System.DateTime object's P:System.DateTime.Kind property is always set to F:System.DateTimeKind.Utc.
Exceptions
T:System.ArgumentExceptiondateTime .Kind is F:System.DateTimeKind.Utc and sourceTimeZone does not equal P:System.TimeZoneInfo.Utc.-or- dateTime .Kind is F:System.DateTimeKind.Local and sourceTimeZone does not equal P:System.TimeZoneInfo.Local.-or- sourceTimeZone .IsInvalidDateTime( dateTime ) returns true.
T:System.ArgumentNullExceptionsourceTimeZone is null.

Definition at line 1777 of file TimeZoneInfo.cs.

◆ CreateCustomTimeZone() [1/3]

static TimeZoneInfo System.TimeZoneInfo.CreateCustomTimeZone ( string  id,
TimeSpan  baseUtcOffset,
string  displayName,
string  standardDisplayName 
)
static

Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, and a standard time display name.

Parameters
idThe time zone's identifier.
baseUtcOffsetAn object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
displayNameThe display name of the new time zone.
standardDisplayNameThe name of the new time zone's standard time.
Returns
The new time zone.
Exceptions
T:System.ArgumentNullExceptionThe id parameter is null.
T:System.ArgumentExceptionThe id parameter is an empty string ("").-or-The baseUtcOffset parameter does not represent a whole number of minutes.
T:System.ArgumentOutOfRangeExceptionThe baseUtcOffset parameter is greater than 14 hours or less than -14 hours.

Definition at line 1980 of file TimeZoneInfo.cs.

◆ CreateCustomTimeZone() [2/3]

static TimeZoneInfo System.TimeZoneInfo.CreateCustomTimeZone ( string  id,
TimeSpan  baseUtcOffset,
string  displayName,
string  standardDisplayName,
string  daylightDisplayName,
AdjustmentRule []  adjustmentRules 
)
static

Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, a standard time name, a daylight saving time name, and daylight saving time rules.

Parameters
idThe time zone's identifier.
baseUtcOffsetAn object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
displayNameThe display name of the new time zone.
standardDisplayNameThe new time zone's standard time name.
daylightDisplayNameThe daylight saving time name of the new time zone.
adjustmentRulesAn array that augments the base UTC offset for a particular period.
Returns
A T:System.TimeZoneInfo object that represents the new time zone.
Exceptions
T:System.ArgumentNullExceptionThe id parameter is null.
T:System.ArgumentExceptionThe id parameter is an empty string ("").-or-The baseUtcOffset parameter does not represent a whole number of minutes.
T:System.ArgumentOutOfRangeExceptionThe baseUtcOffset parameter is greater than 14 hours or less than -14 hours.
T:System.InvalidTimeZoneExceptionThe adjustment rules specified in the adjustmentRules parameter overlap.-or-The adjustment rules specified in the adjustmentRules parameter are not in chronological order.-or-One or more elements in adjustmentRules are null.-or-A date can have multiple adjustment rules applied to it.-or-The sum of the baseUtcOffset parameter and the P:System.TimeZoneInfo.AdjustmentRule.DaylightDelta value of one or more objects in the adjustmentRules array is greater than 14 hours or less than -14 hours.

Definition at line 1997 of file TimeZoneInfo.cs.

◆ CreateCustomTimeZone() [3/3]

static TimeZoneInfo System.TimeZoneInfo.CreateCustomTimeZone ( string  id,
TimeSpan  baseUtcOffset,
string  displayName,
string  standardDisplayName,
string  daylightDisplayName,
AdjustmentRule []  adjustmentRules,
bool  disableDaylightSavingTime 
)
static

Creates a custom time zone with a specified identifier, an offset from Coordinated Universal Time (UTC), a display name, a standard time name, a daylight saving time name, daylight saving time rules, and a value that indicates whether the returned object reflects daylight saving time information.

Parameters
idThe time zone's identifier.
baseUtcOffsetA T:System.TimeSpan object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
displayNameThe display name of the new time zone.
standardDisplayNameThe standard time name of the new time zone.
daylightDisplayNameThe daylight saving time name of the new time zone.
adjustmentRulesAn array of T:System.TimeZoneInfo.AdjustmentRule objects that augment the base UTC offset for a particular period.
disableDaylightSavingTimetrue to discard any daylight saving time-related information present in adjustmentRules with the new object; otherwise, false.
Returns
The new time zone. If the disableDaylightSavingTime parameter is true, the returned object has no daylight saving time data.
Exceptions
T:System.ArgumentNullExceptionThe id parameter is null.
T:System.ArgumentExceptionThe id parameter is an empty string ("").-or-The baseUtcOffset parameter does not represent a whole number of minutes.
T:System.ArgumentOutOfRangeExceptionThe baseUtcOffset parameter is greater than 14 hours or less than -14 hours.
T:System.InvalidTimeZoneExceptionThe adjustment rules specified in the adjustmentRules parameter overlap.-or-The adjustment rules specified in the adjustmentRules parameter are not in chronological order.-or-One or more elements in adjustmentRules are null.-or-A date can have multiple adjustment rules applied to it.-or-The sum of the baseUtcOffset parameter and the P:System.TimeZoneInfo.AdjustmentRule.DaylightDelta value of one or more objects in the adjustmentRules array is greater than 14 hours or less than -14 hours.

Definition at line 2016 of file TimeZoneInfo.cs.

◆ Equals() [1/2]

bool System.TimeZoneInfo.Equals ( TimeZoneInfo  other)

Determines whether the current T:System.TimeZoneInfo object and another T:System.TimeZoneInfo object are equal.

Parameters
otherA second object to compare with the current object.
Returns
true if the two T:System.TimeZoneInfo objects are equal; otherwise, false.

Definition at line 1788 of file TimeZoneInfo.cs.

◆ Equals() [2/2]

override bool System.TimeZoneInfo.Equals ( object  obj)

Determines whether the current T:System.TimeZoneInfo object and another object are equal.

Parameters
objA second object to compare with the current object.
Returns
true if obj is a T:System.TimeZoneInfo object that is equal to the current instance; otherwise, false.

Definition at line 1801 of file TimeZoneInfo.cs.

◆ FindSystemTimeZoneById()

static TimeZoneInfo System.TimeZoneInfo.FindSystemTimeZoneById ( string  id)
static

Retrieves a T:System.TimeZoneInfo object from the registry based on its identifier.

Parameters
idThe time zone identifier, which corresponds to the P:System.TimeZoneInfo.Id property.
Returns
An object whose identifier is the value of the id parameter.
Exceptions
T:System.OutOfMemoryExceptionThe system does not have enough memory to hold information about the time zone.
T:System.ArgumentNullExceptionThe id parameter is null.
T:System.TimeZoneNotFoundExceptionThe time zone identifier specified by id was not found. This means that a registry key whose name matches id does not exist, or that the key exists but does not contain any time zone data.
T:System.Security.SecurityExceptionThe process does not have the permissions required to read from the registry key that contains the time zone information.
T:System.InvalidTimeZoneExceptionThe time zone identifier was found, but the registry data is corrupted.

Definition at line 2515 of file TimeZoneInfo.cs.

◆ FromSerializedString()

static TimeZoneInfo System.TimeZoneInfo.FromSerializedString ( string  source)
static

Deserializes a string to re-create an original serialized T:System.TimeZoneInfo object.

Parameters
sourceThe string representation of the serialized T:System.TimeZoneInfo object.
Returns
The original serialized object.
Exceptions
T:System.ArgumentExceptionThe source parameter is F:System.String.Empty.
T:System.ArgumentNullExceptionThe source parameter is a null string.
T:System.Runtime.Serialization.SerializationExceptionThe source parameter cannot be deserialized back into a T:System.TimeZoneInfo object.

Definition at line 1817 of file TimeZoneInfo.cs.

◆ GetAdjustmentRules()

AdjustmentRule [] System.TimeZoneInfo.GetAdjustmentRules ( )

Retrieves an array of T:System.TimeZoneInfo.AdjustmentRule objects that apply to the current T:System.TimeZoneInfo object.

Returns
An array of objects for this time zone.
Exceptions
T:System.OutOfMemoryExceptionThe system does not have enough memory to make an in-memory copy of the adjustment rules.

Definition at line 1253 of file TimeZoneInfo.cs.

◆ GetAmbiguousTimeOffsets() [1/2]

TimeSpan [] System.TimeZoneInfo.GetAmbiguousTimeOffsets ( DateTimeOffset  dateTimeOffset)

Returns information about the possible dates and times that an ambiguous date and time can be mapped to.

Parameters
dateTimeOffsetA 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.
Exceptions
T:System.ArgumentExceptiondateTimeOffset is not an ambiguous time.

Definition at line 1268 of file TimeZoneInfo.cs.

◆ GetAmbiguousTimeOffsets() [2/2]

TimeSpan [] System.TimeZoneInfo.GetAmbiguousTimeOffsets ( DateTime  dateTime)

Returns information about the possible dates and times that an ambiguous date and time can be mapped to.

Parameters
dateTimeA 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.
Exceptions
T:System.ArgumentExceptiondateTime is not an ambiguous time.

Definition at line 1307 of file TimeZoneInfo.cs.

◆ GetHashCode()

override int System.TimeZoneInfo.GetHashCode ( )

Serves as a hash function for hashing algorithms and data structures such as hash tables.

Returns
A 32-bit signed integer that serves as the hash code for this T:System.TimeZoneInfo object.

Definition at line 1833 of file TimeZoneInfo.cs.

◆ GetSystemTimeZones()

static ReadOnlyCollection<TimeZoneInfo> System.TimeZoneInfo.GetSystemTimeZones ( )
static

Returns a sorted collection of all the time zones about which information is available on the local system.

Returns
A read-only collection of T:System.TimeZoneInfo objects.
Exceptions
T:System.OutOfMemoryExceptionThere is insufficient memory to store all time zone information.
T:System.Security.SecurityExceptionThe user does not have permission to read from the registry keys that contain time zone information.

Definition at line 1844 of file TimeZoneInfo.cs.

◆ GetUtcOffset() [1/2]

TimeSpan System.TimeZoneInfo.GetUtcOffset ( DateTimeOffset  dateTimeOffset)

Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.

Parameters
dateTimeOffsetThe 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.

Definition at line 1358 of file TimeZoneInfo.cs.

◆ GetUtcOffset() [2/2]

TimeSpan System.TimeZoneInfo.GetUtcOffset ( DateTime  dateTime)

Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.

Parameters
dateTimeThe date and time to determine the offset for.
Returns
An object that indicates the time difference between the two time zones.

Definition at line 1367 of file TimeZoneInfo.cs.

◆ HasSameRules()

bool System.TimeZoneInfo.HasSameRules ( TimeZoneInfo  other)

Indicates whether the current object and another T:System.TimeZoneInfo object have the same adjustment rules.

Parameters
otherA second object to compare with the current T:System.TimeZoneInfo object.
Returns
true if the two time zones have identical adjustment rules and an identical base offset; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionThe other parameter is null.

Definition at line 1879 of file TimeZoneInfo.cs.

◆ IsAmbiguousTime() [1/2]

bool System.TimeZoneInfo.IsAmbiguousTime ( DateTimeOffset  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.

Parameters
dateTimeOffsetA date and time.
Returns
true if the dateTimeOffset parameter is ambiguous in the current time zone; otherwise, false.

Definition at line 1409 of file TimeZoneInfo.cs.

◆ IsAmbiguousTime() [2/2]

bool System.TimeZoneInfo.IsAmbiguousTime ( DateTime  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.

Parameters
dateTimeA date and time value.
Returns
true if the dateTime parameter is ambiguous; otherwise, false.
Exceptions
T:System.ArgumentExceptionThe P:System.DateTime.Kind property of the dateTime value is F:System.DateTimeKind.Local and dateTime is an invalid time.

Definition at line 1424 of file TimeZoneInfo.cs.

◆ IsDaylightSavingTime() [1/2]

bool System.TimeZoneInfo.IsDaylightSavingTime ( DateTimeOffset  dateTimeOffset)

Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current T:System.TimeZoneInfo object.

Parameters
dateTimeOffsetA date and time value.
Returns
true if the dateTimeOffset parameter is a daylight saving time; otherwise, false.

Definition at line 1464 of file TimeZoneInfo.cs.

◆ IsDaylightSavingTime() [2/2]

bool System.TimeZoneInfo.IsDaylightSavingTime ( DateTime  dateTime)

Indicates whether a specified date and time falls in the range of daylight saving time for the time zone of the current T:System.TimeZoneInfo object.

Parameters
dateTimeA date and time value.
Returns
true if the dateTime parameter is a daylight saving time; otherwise, false.
Exceptions
T:System.ArgumentExceptionThe P:System.DateTime.Kind property of the dateTime value is F:System.DateTimeKind.Local and dateTime is an invalid time.

Definition at line 1476 of file TimeZoneInfo.cs.

◆ IsInvalidTime()

bool System.TimeZoneInfo.IsInvalidTime ( DateTime  dateTime)

Indicates whether a particular date and time is invalid.

Parameters
dateTimeA date and time value.
Returns
true if dateTime is invalid; otherwise, false.

Definition at line 1524 of file TimeZoneInfo.cs.

◆ ToSerializedString()

string System.TimeZoneInfo.ToSerializedString ( )

Converts the current T:System.TimeZoneInfo object to a serialized string.

Returns
A string that represents the current T:System.TimeZoneInfo object.

Definition at line 1915 of file TimeZoneInfo.cs.

◆ ToString()

override string System.TimeZoneInfo.ToString ( )

Returns the current T:System.TimeZoneInfo object's display name.

Returns
The value of the P:System.TimeZoneInfo.DisplayName property of the current T:System.TimeZoneInfo object.

Definition at line 1923 of file TimeZoneInfo.cs.

Property Documentation

◆ BaseUtcOffset

TimeSpan System.TimeZoneInfo.BaseUtcOffset
get

Gets the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).

Returns
An object that indicates the time difference between the current time zone's standard time and Coordinated Universal Time (UTC).

Definition at line 1205 of file TimeZoneInfo.cs.

◆ DaylightName

string System.TimeZoneInfo.DaylightName
get

Gets the display name for the current time zone's daylight saving time.

Returns
The display name for the time zone's daylight saving time.

Definition at line 1189 of file TimeZoneInfo.cs.

◆ DisplayName

string System.TimeZoneInfo.DisplayName
get

Gets the general display name that represents the time zone.

Returns
The time zone's general display name.

Definition at line 1157 of file TimeZoneInfo.cs.

◆ Id

string System.TimeZoneInfo.Id
get

Gets the time zone identifier.

Returns
The time zone identifier.

Definition at line 1145 of file TimeZoneInfo.cs.

◆ Local

TimeZoneInfo System.TimeZoneInfo.Local
staticget

Gets a T:System.TimeZoneInfo object that represents the local time zone.

Returns
An object that represents the local time zone.

Definition at line 1230 of file TimeZoneInfo.cs.

◆ StandardName

string System.TimeZoneInfo.StandardName
get

Gets the display name for the time zone's standard time.

Returns
The display name of the time zone's standard time.

Definition at line 1173 of file TimeZoneInfo.cs.

◆ SupportsDaylightSavingTime

bool System.TimeZoneInfo.SupportsDaylightSavingTime
get

Gets a value indicating whether the time zone has any daylight saving time rules.

Returns
true if the time zone supports daylight saving time; otherwise, false.

Definition at line 1218 of file TimeZoneInfo.cs.

◆ Utc

TimeZoneInfo System.TimeZoneInfo.Utc
staticget

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

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

Definition at line 1242 of file TimeZoneInfo.cs.


The documentation for this class was generated from the following file: