org.silverpeas.util.time
Class TimeData

java.lang.Object
  extended by org.silverpeas.util.time.TimeData

public class TimeData
extends Object

User: Yohann Chastagnier Date: 14/11/13


Constructor Summary
TimeData(BigDecimal time)
          Hidden constructor
TimeData(long time)
          Hidden constructor
 
Method Summary
static BigDecimal convertTo(BigDecimal value, TimeUnit from, TimeUnit to)
          Converting a value
 String getBestDisplayValue()
          Gets the best display value
 String getBestDisplayValueOnly()
          Gets the best display value
 TimeUnit getBestUnit()
          Gets the best unit (for display as example).
 BigDecimal getBestValue()
          Gets the best unformatted value (for display as example).
 String getFormattedDuration(String format)
           
 String getFormattedDurationAsHMS()
           
 String getFormattedDurationAsHMSM()
           
 String getFormattedValue(TimeUnit to)
          Gets the desired value with its label
 String getFormattedValueOnly(TimeUnit to)
          Gets the desired value only
 BigDecimal getRoundedTimeConverted(TimeUnit to)
          Gets the time converted to desired unit.
 BigDecimal getTime()
          Gets the time in milliseconds.
 Long getTimeAsLong()
          Gets the time in milliseconds.
 BigDecimal getTimeConverted(TimeUnit to)
          Gets the time converted to desired unit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeData

public TimeData(long time)
Hidden constructor

Parameters:
time -

TimeData

public TimeData(BigDecimal time)
Hidden constructor

Parameters:
time -
Method Detail

convertTo

public static BigDecimal convertTo(BigDecimal value,
                                   TimeUnit from,
                                   TimeUnit to)
Converting a value

Parameters:
value -
from -
to -
Returns:

getTime

public BigDecimal getTime()
Gets the time in milliseconds.

Returns:

getTimeAsLong

public Long getTimeAsLong()
Gets the time in milliseconds.

Returns:

getRoundedTimeConverted

public BigDecimal getRoundedTimeConverted(TimeUnit to)
Gets the time converted to desired unit.

Parameters:
to -
Returns:

getTimeConverted

public BigDecimal getTimeConverted(TimeUnit to)
Gets the time converted to desired unit.

Parameters:
to -
Returns:

getBestUnit

public TimeUnit getBestUnit()
Gets the best unit (for display as example).

Returns:

getBestValue

public BigDecimal getBestValue()
Gets the best unformatted value (for display as example).

Returns:

getBestDisplayValueOnly

public String getBestDisplayValueOnly()
Gets the best display value

Returns:

getBestDisplayValue

public String getBestDisplayValue()
Gets the best display value

Returns:

getFormattedValueOnly

public String getFormattedValueOnly(TimeUnit to)
Gets the desired value only

Returns:

getFormattedValue

public String getFormattedValue(TimeUnit to)
Gets the desired value with its label

Returns:

getFormattedDurationAsHMSM

public String getFormattedDurationAsHMSM()
See Also:
getFormattedDuration(String)

getFormattedDurationAsHMS

public String getFormattedDurationAsHMS()
See Also:
getFormattedDuration(String)

getFormattedDuration

public String getFormattedDuration(String format)
See Also:
DurationFormatUtils.formatDuration(long, java.lang.String)


Copyright © 2016 Silverpeas. All Rights Reserved.