Package com.atlassian.bamboo.utils
Class DurationUtils
java.lang.Object
com.atlassian.bamboo.utils.DurationUtils
This class provide some Time formatting methods.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetElapsedTime(long fromDate) static longgetElapsedTime(Date fromDate) static DurationUtilsstatic longgetNormalizedTime(long elapsedTimeMillis) Converts time in milliseconds to the number of milliseconds that fill in the nearest hour, minute or second.static StringgetPrettyPrint(long elapsedTimeMillis) static StringgetPrettyPrint(long elapsedTimeMillis, boolean isLong) static StringgetPrettyPrint(long elapsedTimeMillis, PrettyLength prettyLength) Formats time to the nearest hour, minute or second.static StringgetPrettyPrint(@NotNull Duration duration) static StringgetPrettyPrint(@NotNull Duration duration, PrettyLength length) static StringgetRelativeDate(long fromDate) static StringgetRelativeDate(@NotNull Date fromDate) static StringgetRelativeDate(Date fromDate, Date comparedTo) static StringgetRelativeToDate(long fromDate)
-
Field Details
-
NO_DATA_VALUE
public static final long NO_DATA_VALUE- See Also:
-
PRIOR_TEXT
- See Also:
-
AGO
- See Also:
-
-
Method Details
-
getInstance
-
getPrettyPrint
Formats time to the nearest hour, minute or second.Note - Currently ignore hours (display them in minutes) see BJ-119
- Parameters:
elapsedTimeMillis- The timeprettyLength- determines whether you want the long, medium or short string representation, e.g. minute vs min vs m- Returns:
- Nearest time to the nearest hour, minute or second.
-
getPrettyPrint
-
getPrettyPrint
-
getPrettyPrint
-
getPrettyPrint
-
getNormalizedTime
public static long getNormalizedTime(long elapsedTimeMillis) Converts time in milliseconds to the number of milliseconds that fill in the nearest hour, minute or second.- Parameters:
elapsedTimeMillis-- Returns:
- number of milliseconds that fill in the nearest hour, minute or second.
-
getElapsedTime
-
getElapsedTime
public static long getElapsedTime(long fromDate) -
getRelativeDate
-
getRelativeDate
-
getRelativeToDate
-
getRelativeDate
-