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.StringDATEHOUR_NOSPACE_FORMATstatic longFIFTEEN_MINUTESstatic longFIVE_MINUTESstatic longFOUR_HOURSstatic longFOURTY_FIVE_MINUTESstatic java.lang.StringISO_DATETIME_FORMATstatic java.lang.StringISO_DATETIME_TAB_FORMATstatic java.lang.StringISO_YEARMONTH_FORMATstatic longNO_TIME_AVAILABLEstatic longONE_DAYstatic longONE_HOURstatic longONE_MINUTEstatic longONE_SECONDstatic longONE_WEEKstatic longROUGHLY_FIVE_YEARSstatic longROUGHLY_ONE_MONTHstatic longROUGHLY_ONE_YEARstatic longROUGHLY_SIX_MONTHSstatic longROUGHLY_THREE_MONTHSstatic longSIX_HOURSstatic longTEN_DAYSstatic longTEN_SECONDSstatic longTHREE_DAYSstatic longTWELVE_HOURSstatic longTWO_DAYS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringformat(long millis)static java.lang.Stringformat(long millis, java.lang.String format)static longparse(java.lang.String string)Parses the given string usingISO_DATETIME_FORMATas format and return the time in milliseconds since the epoch orNO_TIME_AVAILABLEif the string cannot be parsed.static longparse(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_AVAILABLEif 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_AVAILABLEif the string cannot be parsed.
-
parse
public static long parse(java.lang.String string)
Parses the given string usingISO_DATETIME_FORMATas format and return the time in milliseconds since the epoch orNO_TIME_AVAILABLEif the string cannot be parsed.
-
-