Java java.time Duration fields, constructors, methods, implement or subclass

Example usage for Java java.time Duration fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.time Duration.

The text is from its open source code.

Field

DurationZERO
Constant for a duration of zero.

Method

Durationabs()
Returns a copy of this duration with a positive length.
TemporaladdTo(Temporal temporal)
Adds this duration to the specified temporal object.
Durationbetween(Temporal startInclusive, Temporal endExclusive)
Obtains a Duration representing the duration between two temporal objects.
intcompareTo(Duration otherDuration)
Compares this duration to the specified Duration .
DurationdividedBy(long divisor)
Returns a copy of this duration divided by the specified value.
longdividedBy(Duration divisor)
Returns number of whole times a specified Duration occurs within this Duration.
Durationfrom(TemporalAmount amount)
Obtains an instance of Duration from a temporal amount.
longget(TemporalUnit unit)
Gets the value of the requested unit.
intgetNano()
Gets the number of nanoseconds within the second in this duration.
longgetSeconds()
Gets the number of seconds in this duration.
ListgetUnits()
Gets the set of units supported by this duration.
inthashCode()
A hash code for this duration.
booleanisNegative()
Checks if this duration is negative, excluding zero.
booleanisZero()
Checks if this duration is zero length.
Durationminus(Duration duration)
Returns a copy of this duration with the specified duration subtracted.
Durationminus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this duration with the specified duration subtracted.
DurationminusDays(long daysToSubtract)
Returns a copy of this duration with the specified duration in standard 24 hour days subtracted.
DurationminusHours(long hoursToSubtract)
Returns a copy of this duration with the specified duration in hours subtracted.
DurationminusMillis(long millisToSubtract)
Returns a copy of this duration with the specified duration in milliseconds subtracted.
DurationminusMinutes(long minutesToSubtract)
Returns a copy of this duration with the specified duration in minutes subtracted.
DurationminusNanos(long nanosToSubtract)
Returns a copy of this duration with the specified duration in nanoseconds subtracted.
DurationmultipliedBy(long multiplicand)
Returns a copy of this duration multiplied by the scalar.
Durationnegated()
Returns a copy of this duration with the length negated.
Durationof(long amount, TemporalUnit unit)
Obtains a Duration representing an amount in the specified unit.
DurationofDays(long days)
Obtains a Duration representing a number of standard 24 hour days.
DurationofHours(long hours)
Obtains a Duration representing a number of standard hours.
DurationofMillis(long millis)
Obtains a Duration representing a number of milliseconds.
DurationofMinutes(long minutes)
Obtains a Duration representing a number of standard minutes.
DurationofNanos(long nanos)
Obtains a Duration representing a number of nanoseconds.
DurationofSeconds(long seconds)
Obtains a Duration representing a number of seconds.
Durationparse(CharSequence text)
Obtains a Duration from a text string such as PnDTnHnMn.nS .
Durationplus(Duration duration)
Returns a copy of this duration with the specified duration added.
Durationplus(long amountToAdd, TemporalUnit unit)
Returns a copy of this duration with the specified duration added.
Durationplus(long secondsToAdd, long nanosToAdd)
Returns a copy of this duration with the specified duration added.
DurationplusDays(long daysToAdd)
Returns a copy of this duration with the specified duration in standard 24 hour days added.
DurationplusHours(long hoursToAdd)
Returns a copy of this duration with the specified duration in hours added.
DurationplusMillis(long millisToAdd)
Returns a copy of this duration with the specified duration in milliseconds added.
DurationplusMinutes(long minutesToAdd)
Returns a copy of this duration with the specified duration in minutes added.
DurationplusNanos(long nanosToAdd)
Returns a copy of this duration with the specified duration in nanoseconds added.
DurationplusSeconds(long secondsToAdd)
Returns a copy of this duration with the specified duration in seconds added.
TemporalsubtractFrom(Temporal temporal)
Subtracts this duration from the specified temporal object.
longtoDays()
Gets the number of days in this duration.
longtoHours()
Gets the number of hours in this duration.
longtoMillis()
Converts this duration to the total length in milliseconds.
longtoMinutes()
Gets the number of minutes in this duration.
longtoNanos()
Converts this duration to the total length in nanoseconds expressed as a long .
StringtoString()
A string representation of this duration using ISO-8601 seconds based representation, such as PT8H6M12.345S .
DurationwithNanos(int nanoOfSecond)
Returns a copy of this duration with the specified nano-of-second.
DurationwithSeconds(long seconds)
Returns a copy of this duration with the specified amount of seconds.