Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DateTime structure

Represents an instant in time, typically expressed as a date and time of day.

JavaScript:  This type appears as the Date object.

.NET:  When programming with .NET, this type is hidden, and developers should use the System.DateTimeOffset structure.

C++:  Similar to FILETIME but with important differences. See Remarks.

Syntax


public value struct DateTime

Attributes

[Version(0x06020000)]

Members

The DateTime structure inherits from the IUnknown interface but does not have additional members.

The DateTime structure has these fields.

FieldData typeDescription
UniversalTime

Int64

A 64-bit signed integer that represents a point in time as the number of 100-nanosecond intervals prior to or after midnight on January 1, 1601 (according to the Gregorian Calendar).

 

Remarks

JavaScript and .NET languages do not use this type directly. In JavaScript a DateTime is projected as a DateDate object, and in .NET it is projected as a System.DateTimeOffset. Each language transparently handles the conversion to the granularity and date ranges for the respective language.

In Visual C++ component extensions (C++/CX), a DateTime.UniversalTime value has the same granularity as a FILETIME (100-nanosecond intervals). For positive values, a DateTime.UniversalTime value is identical to a FILETIME value although it can only represent dates up to about 29000 C.E. A negative value represents the number of intervals prior to January 1, 1601 and can represent dates back to about 27,400 B.C.E. For the Gregorian Calendar, you can use a DateTimeFormatter to create string representations of a DateTime for dates after midnight on Year 1 C.E.

To convert the UniversalTime to SYSTEMTIME, use ULARGE_INTEGER to convert the int64 value to FILETIME, then use FileTimeToSystemTime to get SYSTEMTIME.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.FoundationContract, introduced version 1.0

Namespace

Windows::Foundation

Metadata

Windows.Foundation.FoundationContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows::Foundation

Metadata

Windows.winmd

See also

System.DateTimeOffset
Date object
FILETIME

 

 

Show:
© 2015 Microsoft