Java Duration Class Methods

Java Duration class has the following built-in methods.

Method Description
abs() It is used to clone this Duration but available with positive duration value instead of negative duration.
addTo() It is used to add this Duration object into the given Temporal object and returns a Temporal.
between() It is used to get the duration between the two given objects.
compareTo() It is used to compare this Duration object to the given object.
dividedBy() It is used to divide this Duration by the given parameter (divisor) (i.e. this Duration / divisor).
equals() It is used to identifies whether this Duration and the given object are equal or not.
from() is used to return a copy of this Duration from the given TemporalAmount.
get() It is used to return the value for the given unit.
getNano() It is used to return the number of nanoseconds pass in 1 second in this Duration.
getSeconds() It is used to return the number of seconds exists in this Duration.
getUnits() It is used to get the List object that contains the units of seconds and Nanos of this Duration.
hashCode() It is used to get the hash code value for this Duration.
isNegative() It is used to check whether this Duration object holds the value of length < 0 (i.e. negative) or not but it excludes value 0.
isZero() It is used to check whether this Duration object holds the value of length is 0 or not.
minus() It is used to subtract the given Duration from this Duration and returns the Duration.
minusDays() It is used to subtract the given duration in days from this Duration.
minusHours() It is used to subtract the given duration in hours from this Duration.
minusMillis() It is used to subtract the given duration in milliseconds from this Duration and returns the Duration.
minusMinutes() It is used to subtract the given duration in minutes from this Duration and returns the Duration.
minusNanos() It is used to subtract the given duration in nanoseconds from this Duration and returns the Duration.
minusSeconds() It is used to subtract the given duration in seconds from this Duration and returns the Duration.
multipliedBy() It is used to multiply this Duration by the given value.
negated() It is used to represent the negated value of this Duration.
of() It is used to denotes the given amount (amt) in the given unit (t_unit) in this Duration.
ofDays() It is used to represent the given number of days in this Duration.
ofHours() It is used to represent the given hours in this Duration.
ofMillis() It is used to represent the given milliseconds in this Duration.
ofMinutes() It is used to represent the given minutes value in this Duration.
ofNanos() It is used to represent the given nanoseconds value in this Duration.
ofSeconds() It is used to generate a Duration that represent the given seconds.
parse() It is used to return a Duration that parses the given char sequence and char sequence follow some ISO -8601 standard format like PnDTnHnMn.nS.
plus() It is used to add the given Duration to this Duration and return the Duration.
plusDays() It is used to add the given duration in days to this Duration and return the Duration.
plusHours() It is used to add the given duration in hours to this Duration and return the Duration.
plusMillis() It is used to add the given duration in milliseconds to this Duration and return the Duration.
plusMinutes() It is used to add the given duration in minutes to this Duration and return the Duration.
plusNanos() It is used to add the given duration in nanoseconds to this Duration and return the Duration.
plusSeconds() It is used to add the given duration in seconds to this Duration and return the Duration.
subtractFrom() It is used to return Temporal object subtracted this Duration from the given Temporal object.
toDays() It is used to convert this Duration into number of days.
toHours() It is used to convert this Duration into number of hours.
toMillis() It is used to convert this Duration into number of milliseconds.
toMinutes() It is used to convert this Duration into number of minutes.
toNanos() It is used to convert this Duration into number of nanoseconds.
toString() It is used to denote this Duration as a String by using the standards ISO-8601 format like PT8H6M12.345S.
withNanos() It is used to represent this Duration with the given nanoseconds.
withSeconds() It is used to represent this Duration with the given seconds.


Comments and Discussions!

Load comments ↻





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