An Instant
is an object that specifies a specific point in time. For convenience of interoperatbility it uses nanoseconds since the unix-epoch to do so.
The constructor may only be called as such. It's only argument is a BigInt
value that
represents the nanoseconds since the unix-epoch of the instant.
Parses a string
that must be in the same ISO-8601 format as produced by instant.toString()
and creates a new Instant
object from it.
Equivalent to Instant.fromMilliseconds(seconds * 1000)
.
Equivalent to Instant.fromMicroseconds(BigInt(milliseconds) * 1000n)
.
Equivalent to Instant.fromNanoseconds(BigInt(micros) * 1000n)
.
Equivalent to new Instant(nanos)
.
The seconds
property of an Instant
object is readonly and represents the seconds
since unix-epoch.
The milliseconds
property of an Instant
object is readonly and represents the milliseconds
since unix-epoch.
The microseconds
property of an Instant
object is readonly and represents the microseconds
since unix-epoch.
The nanoseconds
property of an Instant
object is readonly and represents the nanoseconds
since unix-epoch.
This creates a ZonedDateTime
by applying a iana timezone or an offset-string to the instant.
This is equivalent to new ZonedDateTime(instant, zone)
Creates an ISO-8601 DateTime-String that always uses the 'Z' timezone postfix.
The schema is: year
-month
-day
Thours
:minutes
:seconds
.nanoseconds
Z
The year
is 0-padded to a minimum of 4 digits. month
, day
, hours
, minutes
, seconds
are 0-padded to a minimum of 2 digits. nanoseconds
is 0-padded to a minimum of 9 digits.
Equivalent to instant.toString()
.