Time - UTC (Coordinated Universal Time) standard

About

UTC is the primary time standard by which the world regulates clocks and time.

It's the consensus international time scale (with leap seconds).

Time zones are expressed using positive or negative offsets from UTC.

_

UTC permits a day to have 86399 seconds or 86401 seconds where necessary in order to keep the day aligned with the Sun.

The UTC time-scale was introduced in 1972, introducing the concept of whole leap-seconds.

List

Javascript

// Now
var now = new Date(); 

// now_utc is an epoch number
var now_utc_number =  Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());

// To string
console.log(new Date(now_utc_number).toISOString());
  • Result: <note tip>The timezone offset is zero as denoted by the suffix Z</note>

Java

see Java - Instant (Moment)

new Date().toInstant()

Documentation / Reference


Powered by ComboStrap