# Class Instant

java.lang.Object
java.time.Instant

All Implemented Interfaces:
  `Comparable<Instant>, TemporalAccessor`

public final class Instant extends java.lang.Object implements Comparable<Instant>, TemporalAccessor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(Instant other)`
  Compares this object to the specified object to determine their relative order.
  `boolean`
  `equals(java.lang.Object obj)`
  `long`
  `getEpochSecond()`
  `int`
  `getNano()`
  `int`
  `hashCode()`
  `Instant`
  `minusMillis(long millisToSubtract)`
  `Instant`
  `minusSeconds(long secondsToSubtract)`
  `static Instant`
  `now()`
  `static Instant`
  `ofEpochMilli(long epochMilli)`
  `static Instant`
  `ofEpochSecond(long epochSecond)`
  `static Instant`
  `ofEpochSecond(long epochSecond, long nanoAdjustment)`
  `static Instant`
  `parse(CharSequence text)`
  `Instant`
  `plusMillis(long millisToAdd)`
  `Instant`
  `plusSeconds(long secondsToAdd)`
  `long`
  `toEpochMilli()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### now

    public static Instant now()

  - ### ofEpochMilli

    public static Instant ofEpochMilli(long epochMilli)

  - ### ofEpochSecond

    public static Instant ofEpochSecond(long epochSecond)

  - ### ofEpochSecond

    public static Instant ofEpochSecond(long epochSecond, long nanoAdjustment)

  - ### parse

    public static Instant parse(CharSequence text)

  - ### getEpochSecond

    public long getEpochSecond()

  - ### getNano

    public int getNano()

  - ### toEpochMilli

    public long toEpochMilli()

  - ### plusSeconds

    public Instant plusSeconds(long secondsToAdd)

  - ### plusMillis

    public Instant plusMillis(long millisToAdd)

  - ### minusSeconds

    public Instant minusSeconds(long secondsToSubtract)

  - ### minusMillis

    public Instant minusMillis(long millisToSubtract)

  - ### compareTo

    public int compareTo(Instant other)
    Description copied from interface: `Comparable`

    Compares this object to the specified object to determine their relative order.

    ###### Parameters

    - `another`: the object to compare to this instance.

    ###### Returns

    Specified by:
      `compareTo` in interface `Comparable<Instant>`
    Returns:

      a negative integer if this instance is less than `another`; a positive integer if this instance is greater than `another`; 0 if this instance has the same order as `another`.

      ###### Throws

      - `ClassCastException`: @throws ClassCastException if `another` cannot be converted into something comparable to `this` instance.

  - ### equals

    public boolean equals(java.lang.Object obj)
    Overrides:
      `equals` in class `java.lang.Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `java.lang.Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `java.lang.Object`