com.atlassian.bamboo.utils
Class DurationUtils

java.lang.Object
  extended by com.atlassian.bamboo.utils.DurationUtils

public class DurationUtils
extends java.lang.Object

This class provide some Time formatting methods.


Field Summary
static java.lang.String AGO
           
static java.lang.String PRIOR_TEXT
           
 
Method Summary
static long getEllapsedTime(java.util.Date fromDate)
           
static long getEllapsedTime(long fromDate)
           
static DurationUtils getInstance()
           
static long getNormalizedTime(long elapsedTimeMillis)
          Converts time in miliseconds to the number of miliseconds that fill in the nearest hour, minute or second.
static java.lang.String getPrettyPrint(long elapsedTimeMillis)
           
static java.lang.String getPrettyPrint(long elapsedTimeMillis, boolean isLong)
           
static java.lang.String getPrettyPrint(long elapsedTimeMillis, PrettyLength prettyLength)
          Formats time to the nearest hour, minute or second.
static java.lang.String getRelativeDate(java.util.Date fromDate)
           
static java.lang.String getRelativeDate(java.util.Date fromDate, java.util.Date comparedTo)
           
static java.lang.String getRelativeDate(long fromDate)
           
static java.lang.String getRelativeToDate(long fromDate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIOR_TEXT

public static final java.lang.String PRIOR_TEXT
See Also:
Constant Field Values

AGO

public static final java.lang.String AGO
See Also:
Constant Field Values
Method Detail

getInstance

public static DurationUtils getInstance()

getPrettyPrint

public static java.lang.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 time
prettyLength - 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 java.lang.String getPrettyPrint(long elapsedTimeMillis)

getPrettyPrint

public static java.lang.String getPrettyPrint(long elapsedTimeMillis,
                                              boolean isLong)

getNormalizedTime

public static long getNormalizedTime(long elapsedTimeMillis)
Converts time in miliseconds to the number of miliseconds that fill in the nearest hour, minute or second.

Parameters:
elapsedTimeMillis -
Returns:
number of miliseconds that fill in the nearest hour, minute or second.

getEllapsedTime

public static long getEllapsedTime(java.util.Date fromDate)

getEllapsedTime

public static long getEllapsedTime(long fromDate)

getRelativeDate

public static java.lang.String getRelativeDate(java.util.Date fromDate)

getRelativeDate

public static java.lang.String getRelativeDate(long fromDate)

getRelativeToDate

public static java.lang.String getRelativeToDate(long fromDate)

getRelativeDate

public static java.lang.String getRelativeDate(java.util.Date fromDate,
                                               java.util.Date comparedTo)


Copyright © 2012 Atlassian. All Rights Reserved.