A specific instant of time on a continuous time-scale.

An instant represents a single point in time irrespective of any time-zone offsets or geographical locations.

no subtypes hierarchy

Initializer
Instant(Integer millisecondsOfEpoch)
Parameters:
  • millisecondsOfEpoch

    Internal value of an instant as a number of milliseconds since 1970-01-01T00:00:00.000Z.

Attributes
hashSource Codeshared actual Integer hash

This implementation respect the constraint that if x==y then x.hash==y.hash.

Refines Identifiable.hash ultimately refines Object.hash
millisecondsOfEpochSource Codeshared actual Integer millisecondsOfEpoch

Internal value of an instant as a number of milliseconds since 1970-01-01T00:00:00.000Z.

stringSource Codeshared actual String string

Returns ISO-8601 formatted String representation of this time of day in UTC.

Reference: ISO-8601 Time Offsets from UTC

Inherited Attributes
Attributes inherited from: Ordinal<Other>
Attributes inherited from: ReadableInstant
Methods
compareSource Codeshared actual Comparison compare(Instant other)

Compares this instant to the other instant.

dateSource Codeshared Date date(TimeZone timeZone = ...)

Returns this instant as a Date value.

Parameters:
  • timeZone = tz.system
dateTimeSource Codeshared DateTime dateTime(TimeZone timeZone = ...)

Returns this instant as a DateTime value.

Parameters:
  • timeZone = tz.system
durationFromSource Codeshared Duration durationFrom(Instant other)

Returns duration in milliseconds from other instant to this instant.

durationToSource Codeshared Duration durationTo(Instant other)

Returns duration in milliseconds from this instant to the other instant.

equalsSource Codeshared actual Boolean equals(Object other)

Returns true if given value is same type and milliseconds of epoch.

Refines Identifiable.equals ultimately refines Object.equals
minusSource Codeshared Instant minus(Duration|Period other)

Subtracts a period to this instant.

neighbourSource Codeshared actual Instant neighbour(Integer offset)

The indirect successor or predecessor at the given offset, where:

  • x.neighbour(0) == x,
  • x.neighbour(i+1) == x.neighbour(i).successor, and
  • x.neighbour(i-1) == x.neighbour(i).predecessor.
offsetSource Codeshared actual Integer offset(Instant other)

Compute the offset from the given value, where:

  • x.offset(x) == 0, and
  • x.successor.offset(x) == 1 if x!=x.successor.
plusSource Codeshared Instant plus(Duration|Period other)

Adds a period to this instant.

timeSource Codeshared Time time(TimeZone timeZone = ...)

Returns time of day for this instant.

Parameters:
  • timeZone = tz.system
zoneDateTimeSource Codeshared ZoneDateTime zoneDateTime(TimeZone timeZone = ...)

Returns ZoneDateTime value for this instant.

Parameters:
  • timeZone = tz.system
Inherited Methods
Methods inherited from: Comparable<Other>
Methods inherited from: Enumerable<Other>