Represents an instant in time, typically expressed as a date and time of day.
JavaScript: This type appears as the Date object.
.NET: This type appears as the System.DateTimeOffset structure.
Note C++
Note Similar to FILETIME but with important differences. See Remarks.
Syntax
public value struct DateTime
Attributes
- VersionAttribute(NTDDI_WIN8)
Members
The DateTime structure inherits from the IUnknown interface but does not have additional members.
The DateTime structure has these fields.
| Field | Data type | Description |
|---|---|---|
| UniversalTime |
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 Date 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 C++, a DateTime.UniversalTime value has the same granularity as a FILETIME and supports the date ranges required by Javascript and .NET. 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
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Minimum supported phone | Windows Phone 8 |
|
Namespace |
Windows::Foundation |
|
Metadata |
|
Build date: 2/25/2013