DateTimeOffset Constructor (DateTime)

 

Initializes a new instance of the DateTimeOffset structure using the specified DateTime value.

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

new : 
        dateTime:DateTime -> DateTimeOffset

Parameters

dateTime
Type: System.DateTime

A date and time.

Exception Condition
ArgumentOutOfRangeException

The Coordinated Universal Time (UTC) date and time that results from applying the offset is earlier than MinValue.

-or-

The UTC date and time that results from applying the offset is later than MaxValue.

This constructor's behavior depends on the value of the DateTime.Kind property of the dateTime parameter:

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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
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
Return to top
Show: