This documentation is archived and is not being maintained.

TimeZoneInfo.ConvertTimeBySystemTimeZoneId Method (DateTimeOffset, String)

Updated: April 2009

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

Namespace:  System
Assembly:  System.Core (in System.Core.dll)

public static DateTimeOffset ConvertTimeBySystemTimeZoneId(
	DateTimeOffset dateTimeOffset,
	string destinationTimeZoneId


Type: System.DateTimeOffset

The date and time to convert.

Type: System.String

The identifier of the destination time zone.

Return Value

Type: System.DateTimeOffset
A DateTimeOffset value that represents the date and time in the destination time zone.


destinationTimeZoneId is null.


The time zone identifier was found but the registry data is corrupted.


The process does not have the permissions required to read from the registry key that contains the time zone information.


The destinationTimeZoneId identifier was not found on the local system.

When performing the conversion, the ConvertTimeBySystemTimeZoneId method applies any adjustment rules in effect in the destinationTimeZoneId time zone.

This overload is identical to calling the ConvertTime(DateTime, TimeZoneInfo) method, except that it allows you to specify the destination time zone by its identifier rather than by an object reference. This method is most useful when you must convert a time without retrieving the time zone object that corresponds to it and you do not need to know whether the converted time is standard or daylight saving time.

Because the dateTimeOffset parameter represents a date and time together with that time's offset from Coordinated Universal Time (UTC), it cannot represent either an ambiguous time or an invalid time.

This method retrieves the time zone whose identifier is specified by the destinationTimeZoneId parameter from the registry. It cannot retrieve a time zone object that is created using the CreateCustomTimeZone method. The destinationTimeZoneId parameter must correspond exactly to the time zone's registry key in length, but not in case, for a successful match to occur; that is, the comparison of destinationTimeZoneId with time zone identifiers is case-insensitive.

In converting the dateTimeOffset value to the time in the destination time zone, the method takes into account any adjustment rules in effect in the destination time zone.

If the conversion of dateTimeOffset results in a date and time value that is earlier than DateTimeOffset.MinValue or later than DateTimeOffset.MaxValue, this method returns DateTimeOffset.MinValue or DateTimeOffset.MaxValue, respectively.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5




April 2009

Added exception information.

Information enhancement.