DateTimeOffset Constructor (DateTime)
Initializes a new instance of the DateTimeOffset structure using the specified DateTime value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- dateTime
-
Type:
System::DateTime
A date and time.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException |
This constructor's behavior depends on the value of the DateTime::Kind property of the dateTime parameter:
If the value of DateTime::Kind is DateTimeKind::Utc, the DateTime property of the new instance is set equal to dateTime, and the Offset property is set equal to Zero.
If the value of DateTime::Kind is DateTimeKind::Local or DateTimeKind::Unspecified, the DateTime property of the new instance is set equal to dateTime, and the Offset property is set equal to the offset of the local system's current time zone.
The following example illustrates how the value of the DateTime::Kind property of the dateTime parameter affects the date and time value that is returned by this constructor.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1