2 out of 22 rated this helpful - Rate this topic

DateTime structure

Applies to Windows and Windows Phone

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.

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 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

Windows.winmd

See also

System.DateTimeOffset
Date object

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.