xtd 0.2.0
Loading...
Searching...
No Matches

◆ utc_now()

static date_time xtd::date_time::utc_now ( )
staticnoexcept

Gets a xtd::date_time object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).

Returns
An object whose value is the current UTC date and time.
Examples
The following example uses the xtd::date_time::specify_kind method to demonstrate how the xtd::date_time::kind property influences the xtd::date_time::to_local_time and xtd::date_time::to_universal_time conversion methods.
Remarks
The resolution of this property depends on the system timer, which depends on the underlying operating system. It tends to be between 0.5 and 15 milliseconds.
The return value is a xtd::date_time whose xtd::date_time::kind property returns xtd::date_time_kind::utc.
An alternative to using xtd::date_time::utc_now is xtd::date_time_offset::utc_now. While the former indicates that a date and time value is Coordinated Universal Time (UTC) by assigning xtd::date_time_kind::utc to its xtd::date_time::kind property, the latter assigns the date and time value the UTC time's offset (equal to xtd::ticks(0)).