Package com.atlassian.bamboo.utils
Class DurationUtils
java.lang.Object
com.atlassian.bamboo.utils.DurationUtils
This class provide some Time formatting methods.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
getElapsedTime
(long fromDate) static long
getElapsedTime
(Date fromDate) static DurationUtils
static long
getNormalizedTime
(long elapsedTimeMillis) Converts time in milliseconds to the number of milliseconds that fill in the nearest hour, minute or second.static String
getPrettyPrint
(long elapsedTimeMillis) static String
getPrettyPrint
(long elapsedTimeMillis, boolean isLong) static String
getPrettyPrint
(long elapsedTimeMillis, PrettyLength prettyLength) Formats time to the nearest hour, minute or second.static String
getRelativeDate
(long fromDate) static String
getRelativeDate
(@NotNull Date fromDate) static String
getRelativeDate
(Date fromDate, Date comparedTo) static String
getRelativeToDate
(long fromDate)
-
Field Details
-
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
-
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
-