public class Duration extends Object
Duration is a drop-in substitute for Java8 provided Duration class.
On Android, Java8 is not supported at the moment therefore, we can
NOT use classes/constructs and features offered exclusively
by Java8. This is applicable only for Java SDK.
Unlike Java8 Duration, this class can not record time duration of magnitude lesser than a millisecond.
| Modifier and Type | Method and Description |
|---|---|
static Duration |
ofHours(long hours)
Returns duration instance with duration specified
|
static Duration |
ofMillis(long millis)
Returns duration instance with duration specified.
|
static Duration |
ofMinutes(long minutes)
Returns duration instance with duration specified
|
static Duration |
ofSeconds(long seconds)
Returns duration instance with duration specified.
|
long |
toHours()
Returns no of hours in this duration
|
long |
toMillis()
Returns no of seconds in this duration.
|
long |
toMinutes()
Returns no of minutes in this duration.
|
long |
toSeconds()
Returns no of seconds in this duration.
|
public static Duration ofMillis(long millis)
millis - millispublic static Duration ofSeconds(long seconds)
seconds - secondspublic static Duration ofMinutes(long minutes)
minutes - minutespublic static Duration ofHours(long hours)
hours - hourspublic long toMillis()
longpublic long toSeconds()
longpublic long toMinutes()
longpublic long toHours()
Copyright © 2019. All rights reserved.