DateTimeOffset Constructor (DateTime, TimeSpan)
Assemblies: System.Runtime (in System.Runtime.dll)
mscorlib (in mscorlib.dll)
dateTime.Kind equals Utc and offset does not equal zero.
dateTime.Kind equals Local and offset does not equal the offset of the system's local time zone.
offset is not specified in whole minutes.
offset is less than -14 hours or greater than 14 hours.
This constructor's behavior depends in part on the value of the Kind property of the dateTime parameter:
If the value of Kind is DateTimeKind.Local, the value of the offset parameter must be equal to the local time zone's offset from Coordinated Universal Time (UTC) for that particular date or an ArgumentException is thrown.
The following example shows how to initialize a DateTimeOffset object with a date and time and the offset of the local time zone when that time zone is not known in advance.
.NET FrameworkSupported in: 4.6, 4, 3.5 SP1, 3.0 SP1, 2.0 SP1
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.