public class TimeUtils extends Object
Modifier and Type | Field and Description |
---|---|
static long |
MILLISECONDS_IN_NANOSECONDS
To convert milliseconds in nanoseconds
|
Modifier and Type | Method and Description |
---|---|
static long |
convertInMilliseconds(String duration)
Convert a string which represents a duration.
|
static long |
convertInSeconds(String duration)
Convert a string which represents a duration.
|
public static final long MILLISECONDS_IN_NANOSECONDS
public static long convertInMilliseconds(String duration)
- "1d2h3m4.5s": one day, two hours, three minutes, four seconds and 500 milliseconds
- "2h30m": two hours and 30 minutes - "30.5s": 30 seconds and 500 ms - "180s": three minutesduration
- a String which describes the durationpublic static long convertInSeconds(String duration)
- "1d2h3m4.5s": one day, two hours, three minutes, four seconds and 500 milliseconds
- "2h30m": two hours and 30 minutes - "30.5s": 30 seconds and 500 ms - "180s": three minutesduration
- a String which describes the durationCopyright © 2018. All rights reserved.