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 TypeMethodDescriptionintCompares this object to the specified object to determine their relative order.booleanequals(java.lang.Object obj) longintgetNano()inthashCode()minusMillis(long millisToSubtract) minusSeconds(long secondsToSubtract) static Instantnow()static InstantofEpochMilli(long epochMilli) static InstantofEpochSecond(long epochSecond) static InstantofEpochSecond(long epochSecond, long nanoAdjustment) static Instantparse(CharSequence text) plusMillis(long millisToAdd) plusSeconds(long secondsToAdd) longtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Method Details
-
now
-
ofEpochMilli
-
ofEpochSecond
-
ofEpochSecond
-
parse
-
getEpochSecond
public long getEpochSecond() -
getNano
public int getNano() -
toEpochMilli
public long toEpochMilli() -
plusSeconds
-
plusMillis
-
minusSeconds
-
minusMillis
-
compareTo
Description copied from interface:ComparableCompares this object to the specified object to determine their relative order.
Parameters
another: the object to compare to this instance.
Returns
- Specified by:
compareToin interfaceComparable<Instant>- Returns:
a negative integer if this instance is less than
another; a positive integer if this instance is greater thananother; 0 if this instance has the same order asanother.Throws
ClassCastException: @throws ClassCastException ifanothercannot be converted into something comparable tothisinstance.
-
equals
public boolean equals(java.lang.Object obj) - Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
- Overrides:
toStringin classjava.lang.Object
-