Interface Instant

A Java Instant.

Hierarchy

  • Instant

Methods

  • Compares this instant to the specified instant.

    The comparison is based on the time-line position of the instants. It is "consistent with equals".

    Returns

    the comparator value, negative if less, positive if greater

    Parameters

    • otherInstant: Instant

      the other instant to compare to

    Returns number

  • Checks if this instant is equal to the specified instant.

    The comparison is based on the time-line position of the instants.

    Returns

    true if the other instant is equal to this one

    Parameters

    • otherInstant: any

      the other instant, null returns false

    Returns boolean

  • Returns a hash code for this instant.

    Returns

    a suitable hash code

    Returns number

  • Checks if this instant is after the specified instant.

    The comparison is based on the time-line position of the instants.

    Returns

    true if this instant is after the specified instant

    Parameters

    • otherInstant: Instant

      the other instant to compare to

    Returns boolean

  • Checks if this instant is before the specified instant.

    The comparison is based on the time-line position of the instants.

    Returns

    true if this instant is before the specified instant

    Parameters

    • otherInstant: Instant

      the other instant to compare to

    Returns boolean

  • Returns a copy of this instant with the specified duration in milliseconds subtracted.

    This instance is immutable and unaffected by this method call.

    Returns

    an Instant based on this instant with the specified milliseconds subtracted

    Throws

    DateTimeException if the result exceeds the maximum or minimum instant

    Throws

    ArithmeticException if numeric overflow occurs

    Parameters

    • millisToSubtract: number

      the milliseconds to subtract, positive or negative

    Returns Instant

  • Returns a copy of this instant with the specified duration in nanoseconds subtracted.

    This instance is immutable and unaffected by this method call.

    Returns

    an Instant based on this instant with the specified nanoseconds subtracted

    Throws

    DateTimeException if the result exceeds the maximum or minimum instant

    Throws

    ArithmeticException if numeric overflow occurs

    Parameters

    • nanosToSubtract: number

      the nanoseconds to subtract, positive or negative

    Returns Instant

  • Returns a copy of this instant with the specified duration in seconds subtracted.

    This instance is immutable and unaffected by this method call.

    Returns

    an Instant based on this instant with the specified seconds subtracted

    Throws

    DateTimeException if the result exceeds the maximum or minimum instant

    Throws

    ArithmeticException if numeric overflow occurs

    Parameters

    • secondsToSubtract: number

      the seconds to subtract, positive or negative

    Returns Instant

  • Returns a copy of this instant with the specified duration in milliseconds added.

    This instance is immutable and unaffected by this method call.

    Returns

    an Instant based on this instant with the specified milliseconds added

    Throws

    DateTimeException if the result exceeds the maximum or minimum instant

    Throws

    ArithmeticException if numeric overflow occurs

    Parameters

    • millisToAdd: number

      the milliseconds to add, positive or negative

    Returns Instant

  • Returns a copy of this instant with the specified duration in nanoseconds added.

    This instance is immutable and unaffected by this method call.

    Returns

    an Instant based on this instant with the specified nanoseconds added

    Throws

    DateTimeException if the result exceeds the maximum or minimum instant

    Throws

    ArithmeticException if numeric overflow occurs

    Parameters

    • nanosToAdd: number

      the nanoseconds to add, positive or negative

    Returns Instant

  • Returns a copy of this instant with the specified duration in seconds added.

    This instance is immutable and unaffected by this method call.

    Returns

    an Instant based on this instant with the specified seconds added

    Throws

    DateTimeException if the result exceeds the maximum or minimum instant

    Throws

    ArithmeticException if numeric overflow occurs

    Parameters

    • secondsToAdd: number

      the seconds to add, positive or negative

    Returns Instant

  • Converts this instant to the number of milliseconds from the epoch of 1970-01-01T00:00:00Z.

    If this instant represents a point on the time-line too far in the future or past to fit in a long milliseconds, then an exception is thrown.

    If this instant has greater than millisecond precision, then the conversion will drop any excess precision information as though the amount in nanoseconds was subject to integer division by one million.

    Returns

    the number of milliseconds since the epoch of 1970-01-01T00:00:00Z

    Throws

    ArithmeticException if numeric overflow occurs

    Returns number

  • A string representation of this instant using ISO-8601 representation.

    Returns

    an ISO-8601 representation of this instant

    Returns string