Class DateTimeHelper
- java.lang.Object
-
- org.torproject.metrics.onionoo.docs.DateTimeHelper
-
public class DateTimeHelper extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DATEHOUR_NOSPACE_FORMAT
static long
FIFTEEN_MINUTES
static long
FIVE_MINUTES
static long
FOUR_HOURS
static long
FOURTY_FIVE_MINUTES
static java.lang.String
ISO_DATETIME_FORMAT
static java.lang.String
ISO_DATETIME_TAB_FORMAT
static java.lang.String
ISO_YEARMONTH_FORMAT
static long
NO_TIME_AVAILABLE
static long
ONE_DAY
static long
ONE_HOUR
static long
ONE_MINUTE
static long
ONE_SECOND
static long
ONE_WEEK
static long
ROUGHLY_FIVE_YEARS
static long
ROUGHLY_ONE_MONTH
static long
ROUGHLY_ONE_YEAR
static long
ROUGHLY_SIX_MONTHS
static long
ROUGHLY_THREE_MONTHS
static long
SIX_HOURS
static long
TEN_DAYS
static long
TEN_SECONDS
static long
THREE_DAYS
static long
TWELVE_HOURS
static long
TWO_DAYS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
format(long millis)
static java.lang.String
format(long millis, java.lang.String format)
static long
parse(java.lang.String string)
Parses the given string usingISO_DATETIME_FORMAT
as format and return the time in milliseconds since the epoch orNO_TIME_AVAILABLE
if the string cannot be parsed.static long
parse(java.lang.String string, java.lang.String format)
Parses the given string using the given format and return the time in milliseconds since the epoch orNO_TIME_AVAILABLE
if the string cannot be parsed.
-
-
-
Field Detail
-
NO_TIME_AVAILABLE
public static final long NO_TIME_AVAILABLE
- See Also:
- Constant Field Values
-
ONE_SECOND
public static final long ONE_SECOND
- See Also:
- Constant Field Values
-
TEN_SECONDS
public static final long TEN_SECONDS
- See Also:
- Constant Field Values
-
ONE_MINUTE
public static final long ONE_MINUTE
- See Also:
- Constant Field Values
-
FIVE_MINUTES
public static final long FIVE_MINUTES
- See Also:
- Constant Field Values
-
FIFTEEN_MINUTES
public static final long FIFTEEN_MINUTES
- See Also:
- Constant Field Values
-
FOURTY_FIVE_MINUTES
public static final long FOURTY_FIVE_MINUTES
- See Also:
- Constant Field Values
-
ONE_HOUR
public static final long ONE_HOUR
- See Also:
- Constant Field Values
-
FOUR_HOURS
public static final long FOUR_HOURS
- See Also:
- Constant Field Values
-
SIX_HOURS
public static final long SIX_HOURS
- See Also:
- Constant Field Values
-
TWELVE_HOURS
public static final long TWELVE_HOURS
- See Also:
- Constant Field Values
-
ONE_DAY
public static final long ONE_DAY
- See Also:
- Constant Field Values
-
TWO_DAYS
public static final long TWO_DAYS
- See Also:
- Constant Field Values
-
THREE_DAYS
public static final long THREE_DAYS
- See Also:
- Constant Field Values
-
ONE_WEEK
public static final long ONE_WEEK
- See Also:
- Constant Field Values
-
TEN_DAYS
public static final long TEN_DAYS
- See Also:
- Constant Field Values
-
ROUGHLY_ONE_MONTH
public static final long ROUGHLY_ONE_MONTH
- See Also:
- Constant Field Values
-
ROUGHLY_THREE_MONTHS
public static final long ROUGHLY_THREE_MONTHS
- See Also:
- Constant Field Values
-
ROUGHLY_SIX_MONTHS
public static final long ROUGHLY_SIX_MONTHS
- See Also:
- Constant Field Values
-
ROUGHLY_ONE_YEAR
public static final long ROUGHLY_ONE_YEAR
- See Also:
- Constant Field Values
-
ROUGHLY_FIVE_YEARS
public static final long ROUGHLY_FIVE_YEARS
- See Also:
- Constant Field Values
-
ISO_DATETIME_FORMAT
public static final java.lang.String ISO_DATETIME_FORMAT
- See Also:
- Constant Field Values
-
ISO_DATETIME_TAB_FORMAT
public static final java.lang.String ISO_DATETIME_TAB_FORMAT
- See Also:
- Constant Field Values
-
ISO_YEARMONTH_FORMAT
public static final java.lang.String ISO_YEARMONTH_FORMAT
- See Also:
- Constant Field Values
-
DATEHOUR_NOSPACE_FORMAT
public static final java.lang.String DATEHOUR_NOSPACE_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
format
public static java.lang.String format(long millis, java.lang.String format)
-
format
public static java.lang.String format(long millis)
-
parse
public static long parse(java.lang.String string, java.lang.String format)
Parses the given string using the given format and return the time in milliseconds since the epoch orNO_TIME_AVAILABLE
if the string cannot be parsed.
-
parse
public static long parse(java.lang.String string)
Parses the given string usingISO_DATETIME_FORMAT
as format and return the time in milliseconds since the epoch orNO_TIME_AVAILABLE
if the string cannot be parsed.
-
-