Package com.atlassian.bamboo.utils
Class DurationUtils
- java.lang.Object
-
- com.atlassian.bamboo.utils.DurationUtils
-
public class DurationUtils extends Object
This class provide some Time formatting methods.
-
-
Field Summary
Fields Modifier and Type Field Description static String
AGO
static String
PRIOR_TEXT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
getElapsedTime(long fromDate)
static long
getElapsedTime(Date fromDate)
static DurationUtils
getInstance()
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 Detail
-
PRIOR_TEXT
public static final String PRIOR_TEXT
- See Also:
- Constant Field Values
-
AGO
public static final String AGO
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static DurationUtils getInstance()
-
getPrettyPrint
public static String getPrettyPrint(long elapsedTimeMillis, PrettyLength prettyLength)
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
public static String getPrettyPrint(long elapsedTimeMillis)
-
getPrettyPrint
public static String getPrettyPrint(long elapsedTimeMillis, boolean isLong)
-
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
public static long getElapsedTime(Date fromDate)
-
getElapsedTime
public static long getElapsedTime(long fromDate)
-
getRelativeDate
public static String getRelativeDate(long fromDate)
-
getRelativeToDate
public static String getRelativeToDate(long fromDate)
-
-