DateTime Constructor (Int64, DateTimeKind)

DateTime Constructor (Int64, DateTimeKind)

 

Initializes a new instance of the DateTime structure to a specified number of ticks and to Coordinated Universal Time (UTC) or local time.

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

public DateTime(
	long ticks,
	DateTimeKind kind
)

Parameters

ticks
Type: System.Int64

A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar.

kind
Type: System.DateTimeKind

One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither.

Exception Condition
ArgumentOutOfRangeException

ticks is less than DateTime.MinValue or greater than DateTime.MaxValue.

ArgumentException

kind is not one of the DateTimeKind values.

For applications in which portability of date and time data or a limited degree of time zone awareness is important, you can use the corresponding DateTimeOffset constructor.

Universal Windows Platform
Available since 4.5
.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:
© 2016 Microsoft