DateTime DateTime DateTime DateTime DateTime Struct


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++/CX Similar to FILETIME but with important differences. See Remarks.

C++/WinRT This type is a specialization of std::chrono::time_point. See Remarks.

public : struct DateTime
struct winrt::Windows::Foundation::DateTime
public struct DateTime
Public Structure DateTime
var dateTime = {

   universalTime: /* Your value */

Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)


JavaScript and Microsoft .NET languages do not use this type directly. In JavaScript a DateTime is projected as a Date object, and in Microsoft .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.

In C++/WinRT, DateTime is similar to C++/CX in that it has the same granularity as a FILETIME. Unlike C++/CX, it is a specialization of std::chrono::time_point rather than a distinct struct. C++/WinRT provides helper functions to convert DateTime to and from FILETIME and to and from time_t. For more info about these functions, see winrt::clock struct.


UniversalTime UniversalTime UniversalTime UniversalTime 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).


In C++/WinRT, this field does not exist, because in that language projection DateTime is a specialization of std::chrono::time_point. If you need the raw integer value, use time_point::time_since_epoch to obtain a std::chrono::duration, and use its count method to obtain the raw count.

See Also