public final class Duration extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static Duration |
from(String input)
Converts a
String into a duration. |
int |
getDays()
Returns the number of days in this duration.
|
int |
getMonths()
Returns the number of months in this duration.
|
long |
getNanoseconds()
Returns the number of nanoseconds in this duration.
|
int |
hashCode() |
static Duration |
newInstance(int months,
int days,
long nanoseconds)
Creates a duration with the given number of months, days and nanoseconds.
|
String |
toString() |
public static Duration newInstance(int months, int days, long nanoseconds)
months
- the number of monthsdays
- the number of daysnanoseconds
- the number of nanosecondsIllegalArgumentException
- if the values are not all negative or all positivepublic static Duration from(String input)
String
into a duration.
The accepted formats are:
y
: yearsm
: monthsw
: weeksd
: daysh
: hoursm
: minutess
: secondsms
: millisecondsus
or µs
: microsecondsns
: nanosecondsinput
- the String
to convertDuration
public int getMonths()
public int getDays()
public long getNanoseconds()
Copyright © 2012–2018. All rights reserved.