Updated: January 2010
Assembly: mscorlib (in mscorlib.dll)
In performing the conversion to local time, the method first converts the current DateTimeOffset object's date and time to Coordinated Universal Time (UTC) by subtracting the offset from the time. It then converts the UTC date and time to local time by adding the local time zone offset.
The method recognizes only the current adjustment rule when converting from UTC to local time. As a result, conversions for periods before the current adjustment rule came into effect may not accurately reflect the difference between UTC and local time.
Both the value of the current DateTimeOffset object and the value of the DateTimeOffset object returned by the method call represent the same point in time. That is, if both are passed to the DateTimeOffset.Equals(DateTimeOffset, DateTimeOffset) method, the method will return true.
If the conversion causes a time that is out of range of the DateTimeOffset type, the method returns a DateTimeOffset object that has the date and time set to either MaxValue or MinValue and the offset set to the local time zone offset.
The following example uses the method to convert a DateTimeOffset value to local time in the Pacific Standard Time zone. It also illustrates the method's support for the local time zone's adjustment rules.
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.