public class TimeMathParser extends Object
Constructor and Description |
---|
TimeMathParser() |
Modifier and Type | Method and Description |
---|---|
static long |
nowInSeconds() |
static long |
parseTime(long now,
String timeStr,
TimeUnit timeUnit)
Parses a time in String format into a long value
|
static long |
parseTime(String timeStr,
TimeUnit timeUnit)
Parses a time in String format into a long value
|
static long |
parseTimeInSeconds(long now,
String timeStr)
Parses a time in String format into a long value.
|
static long |
parseTimeInSeconds(String timeStr)
Parses a time in String format into a long value.
|
static int |
resolutionInSeconds(String resolutionStr) |
public static long nowInSeconds()
public static int resolutionInSeconds(String resolutionStr)
public static long parseTimeInSeconds(String timeStr)
timeStr
- the string to parsepublic static long parseTime(String timeStr, TimeUnit timeUnit)
timeStr
- the string to parsetimeUnit
- the unit of time to return, if timeStr is numeric then it is assumed to be in the unit timeUnitpublic static long parseTimeInSeconds(long now, String timeStr)
now
- the present time in secondstimeStr
- the string to parsepublic static long parseTime(long now, String timeStr, TimeUnit timeUnit)
now
- the present time in millisecondstimeStr
- the string to parsetimeUnit
- the unit of time to return, if timeStr is numeric then it is assumed to be in the unit timeUnitIllegalArgumentException
- if the format of timeStr is badCopyright © 2018 The Apache Software Foundation. All rights reserved.