class TimeZoneInfo

in global :: System

Represents any time zone in the world.


public TimeSpan 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).

public static DateTime ConvertTime( DateTime dateTime, TimeZoneInfo destinationTimeZone )

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

  • dateTime The date and time to convert.
  • destinationTimeZone The time zone to convert to.
  • Returns The date and time in the destination time zone.

public static DateTime ConvertTime( DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone )

Converts a time from one time zone to another.

  • dateTime The date and time to convert.
  • sourceTimeZone The time zone of .
  • destinationTimeZone The time zone to convert to.
  • Returns The date and time in the destination time zone that corresponds to the parameter in the source time zone.

public static DateTimeOffset ConvertTime( DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone )

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

  • dateTimeOffset The date and time to convert.
  • destinationTimeZone The time zone to convert to.
  • Returns The date and time in the destination time zone.

public static DateTime ConvertTimeBySystemTimeZoneId( DateTime dateTime, string destinationTimeZoneId )

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

  • dateTime The date and time to convert.
  • destinationTimeZoneId The identifier of the destination time zone.
  • Returns The date and time in the destination time zone.

public static DateTime ConvertTimeBySystemTimeZoneId( DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId )

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

  • dateTime The date and time to convert.
  • sourceTimeZoneId The identifier of the source time zone.
  • destinationTimeZoneId The identifier of the destination time zone.
  • Returns The date and time in the destination time zone that corresponds to the parameter in the source time zone.

public static DateTimeOffset ConvertTimeBySystemTimeZoneId( DateTimeOffset dateTimeOffset, string destinationTimeZoneId )

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

  • dateTimeOffset The date and time to convert.
  • destinationTimeZoneId The identifier of the destination time zone.
  • Returns The date and time in the destination time zone.

public static DateTime ConvertTimeFromUtc( DateTime dateTime, TimeZoneInfo destinationTimeZone )

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

  • dateTime The Coordinated Universal Time (UTC).
  • destinationTimeZone The time zone to convert to.
  • Returns The date and time in the destination time zone. Its property is if is ; otherwise, its property is .

public static DateTime ConvertTimeToUtc( DateTime dateTime )

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

  • dateTime The date and time to convert.
  • Returns The Coordinated Universal Time (UTC) that corresponds to the parameter. The value's property is always set to .

public static DateTime ConvertTimeToUtc( DateTime dateTime, TimeZoneInfo sourceTimeZone )

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

  • dateTime The date and time to convert.
  • sourceTimeZone The time zone of .
  • Returns The Coordinated Universal Time (UTC) that corresponds to the parameter. The object's property is always set to .

public 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.

  • id The time zone's identifier.
  • baseUtcOffset An object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
  • displayName The display name of the new time zone.
  • standardDisplayName The name of the new time zone's standard time.
  • Returns The new time zone.

public static TimeZoneInfo CreateCustomTimeZone( string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, TimeZoneInfo.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.

  • id The time zone's identifier.
  • baseUtcOffset An object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
  • displayName The display name of the new time zone.
  • standardDisplayName The new time zone's standard time name.
  • daylightDisplayName The daylight saving time name of the new time zone.
  • adjustmentRules An array that augments the base UTC offset for a particular period.
  • Returns A object that represents the new time zone.

public static TimeZoneInfo CreateCustomTimeZone( string id, TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, TimeZoneInfo.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.

  • id The time zone's identifier.
  • baseUtcOffset A object that represents the time difference between this time zone and Coordinated Universal Time (UTC).
  • displayName The display name of the new time zone.
  • standardDisplayName The standard time name of the new time zone.
  • daylightDisplayName The daylight saving time name of the new time zone.
  • adjustmentRules An array of objects that augment the base UTC offset for a particular period.
  • disableDaylightSavingTime to discard any daylight saving time-related information present in with the new object; otherwise, .
  • Returns The new time zone. If the parameter is , the returned object has no daylight saving time data.

public string 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.

public string DisplayName { get; }

Gets the general display name that represents the time zone.

  • Returns The time zone's general display name.

public bool Equals( object obj )

Determines whether the current object and another object are equal.

  • obj A second object to compare with the current object.
  • Returns if is a object that is equal to the current instance; otherwise, .

public bool Equals( TimeZoneInfo other )

Determines whether the current object and another object are equal.

  • other A second object to compare with the current object.
  • Returns if the two objects are equal; otherwise, .

public static TimeZoneInfo FindSystemTimeZoneById( string id )

Instantiates a new object based on its identifier.

  • id The time zone identifier, which corresponds to the property.
  • Returns An object whose identifier is the value of the parameter.

public static TimeZoneInfo FromSerializedString( string source )

Deserializes a string to re-create an original serialized object.

  • source The string representation of the serialized object.
  • Returns The original serialized object.

public TimeSpan[] GetAmbiguousTimeOffsets( DateTime dateTime )

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

  • 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.

public TimeSpan[] GetAmbiguousTimeOffsets( DateTimeOffset dateTimeOffset )

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

  • 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.

public 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.

  • dateTime The date and time to determine the offset for.
  • Returns An object that indicates the time difference between the two time zones.

public 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.

  • 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.

public bool HasSameRules( TimeZoneInfo other )

Indicates whether the current object and another object have the same adjustment rules.

  • other A second object to compare with the current object.
  • Returns if the two time zones have identical adjustment rules and an identical base offset; otherwise, .

public string Id { get; }

Gets the time zone identifier.

  • Returns The time zone identifier.

public 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.

  • dateTime A date and time value.
  • Returns if the parameter is ambiguous; otherwise, .

public 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.

  • dateTimeOffset A date and time.
  • Returns if the parameter is ambiguous in the current time zone; otherwise, .

public 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 object.

  • dateTime A date and time value.
  • Returns if the parameter is a daylight saving time; otherwise, .

public 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 object.

  • dateTimeOffset A date and time value.
  • Returns if the parameter is a daylight saving time; otherwise, .

public bool IsInvalidTime( DateTime dateTime )

Indicates whether a particular date and time is invalid.

  • dateTime A date and time value.
  • Returns if is invalid; otherwise, .

public static TimeZoneInfo Local { get; }

Gets a object that represents the local time zone.

  • Returns An object that represents the local time zone.

public string StandardName { get; }

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

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

public bool SupportsDaylightSavingTime { get; }

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

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

public static TimeZoneInfo Utc { get; }

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

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

public static bool TryConvertWindowsIdToIanaId( string windowsId, string region, ref string ianaId )

😔 No documentation found.

public static bool TryConvertWindowsIdToIanaId( string windowsId, ref string ianaId )

😔 No documentation found.

public static bool TryConvertIanaIdToWindowsId( string ianaId, ref string windowsId )

😔 No documentation found.

public bool HasIanaId { get; }

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public string ToSerializedString( )

😔 No documentation found.

public TimeZoneInfo.AdjustmentRule[] GetAdjustmentRules( )

😔 No documentation found.

public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones( bool skipSorting )

😔 No documentation found.

public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public static void ClearCachedData( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public static bool TryFindSystemTimeZoneById( string id, ref TimeZoneInfo timeZoneInfo )

😔 No documentation found.