The recognized units of time are the "millisecond", "second", "minute" "hour" and "day". The unit name may be followed by an "s". Thus, "2 day" and "2 days" are equivalent. In the absence of a time unit specification, milliseconds are assumed.
Note
the conversion magic is entirely due to the fact that this class
follows the valueOf convention.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final long | |
| private static final int | |
| private static final String | |
| private static final Pattern | |
| pack-priv static final long | |
| pack-priv final long | |
| pack-priv static final long | |
| pack-priv static final long | |
| private static final int | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public static Duration | |
| public long | |
| public String | |
| public static Duration |
| DAYS_COEFFICIENT | back to summary |
|---|---|
| pack-priv static final long DAYS_COEFFICIENT | |
| DOUBLE_GROUP | back to summary |
|---|---|
| private static final int DOUBLE_GROUP | |
| DOUBLE_PART | back to summary |
|---|---|
| private static final String DOUBLE_PART | |
| DURATION_PATTERN | back to summary |
|---|---|
| private static final Pattern DURATION_PATTERN | |
| HOURS_COEFFICIENT | back to summary |
|---|---|
| pack-priv static final long HOURS_COEFFICIENT | |
| millis | back to summary |
|---|---|
| pack-priv final long millis | |
| MINUTES_COEFFICIENT | back to summary |
|---|---|
| pack-priv static final long MINUTES_COEFFICIENT | |
| SECONDS_COEFFICIENT | back to summary |
|---|---|
| pack-priv static final long SECONDS_COEFFICIENT | |
| UNIT_GROUP | back to summary |
|---|---|
| private static final int UNIT_GROUP | |
| UNIT_PART | back to summary |
|---|---|
| private static final String UNIT_PART | |
| Duration | back to summary |
|---|---|
| public Duration(long millis) | |
| buildByDays | back to summary |
|---|---|
| public static Duration buildByDays(double value) | |
| buildByHours | back to summary |
|---|---|
| public static Duration buildByHours(double value) | |
| buildByMilliseconds | back to summary |
|---|---|
| public static Duration buildByMilliseconds(double value) | |
| buildByMinutes | back to summary |
|---|---|
| public static Duration buildByMinutes(double value) | |
| buildBySeconds | back to summary |
|---|---|
| public static Duration buildBySeconds(double value) | |
| buildUnbounded | back to summary |
|---|---|
| public static Duration buildUnbounded() | |
| getMilliseconds | back to summary |
|---|---|
| public long getMilliseconds() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| valueOf | back to summary |
|---|---|
| public static Duration valueOf(String durationStr) | |