Java Instant Class Methods

Java Instant class has the following built-in methods.

Method Description
adjustInto() It is used to adjust this Instant value into the given Temporal object.
atOffset() It is used to returns OffsetDateTime to merge this Instant with the given zone offset.
atZone() It is used to return ZonedDateTime to merge this Instant with the given zone.
compareTo() It is used to compare this Instant object to the given object.
equals() It is used to identifies whether this Instant and the given object are equal or not.
from() It is used to return a copy of the Instant from the given TemporalAccessor object.
get() It is used to get the value of the given field from this Instant object.
getEpochSecond() It is used to get the number of seconds from the java epoch standard format of 1970-01-01T00:00:00Z.
getLong() It is used to get the value as long for the given temporal field from this Instant.
getNano() It is used to get the number of nanoseconds in a second from this Instant.
hashCode() It is used to get the hash code value for this Instant.
isAfter() It is used to check whether this Instant value comes after the given Instant (ins) value or not.
isBefore() It is used to check whether this Instant value comes before the given Instant (ins) value or not.
isSupported() It is used to identify whether this given field is supported or not on this Instant.
minus() It is used to subtract the given amount from this Instant and return the Instant.
minusMillis() It is used to subtract the given duration in milliseconds from this Instant and returns the Instant.
minusNanos() It is used to subtract the given duration in nanoseconds from this Instant and returns the Instant.
minusSeconds() It is used to subtract the given duration in seconds from this Instant and returns the Instant.
now() It is used to get the current instant generated from the system clock.
ofEpochMilli() It is used to represent an instance of this Instant using the given milliseconds from the java epoch standard format of 1970-01-01T00:00:00Z.
ofEpochSecond() It is used to represent an instance of this Instant by using the given seconds from the java epoch standard format since 1970-01-01T00:00:00Z.
parse() It is used to get an Instant that parses the given char sequence and char sequence follow some standard format like 2007-12-03T10:15:30.00Z.
plus() It is used to add the given amount to this Instant and return the Instant.
plusMillis() It is used to add the given duration in milliseconds to this Instant and return the Instant.
plusNanos() It is used to add the given duration in nanoseconds to this Instant and return the Instant.
plusSeconds() It is used to add the given duration in seconds to this Instant and return the Instant.
query() It is used to query this Instant with the help of the given temporal query object.
range() It is used to get the valid range of values for the given TemporalField.
toEpochMilli() It is used to convert this Instant into number of milliseconds from the Java epoch standard format since 1970-01-01T00:00:00Z.
toString() It is used to represent this Instant as a String by using the standards ISO-8601 format.
truncatedTo() It is used to get an Instant that holds the value of this Instant truncated to the given unit.
until() It is used to determine the amount of time until other Instant in terms of the given unit.
with() It is used to represent this Instant with the given adjuster.


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.