net.sourceforge.java.util.date
Class DateUtils

java.lang.Object
  extended bynet.sourceforge.java.util.date.DateUtils

public class DateUtils
extends Object

Contains Date related formatters and utility methods.

Author:
Sebastian Machhausen

Field Summary
static DateFormat DEFAULT_DATE_TIME_FORMATTER
           The default DateFormat to format date/time objects.
private static NumberFormat DEFAULT_NUMBER_FORMAT
           The internal default formatter for numeric duration values
 
Constructor Summary
DateUtils()
           
 
Method Summary
static String formatDuration(double duration)
           Formats the specified duration in milliseconds to a human readble format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DATE_TIME_FORMATTER

public static final DateFormat DEFAULT_DATE_TIME_FORMATTER

The default DateFormat to format date/time objects.


DEFAULT_NUMBER_FORMAT

private static final NumberFormat DEFAULT_NUMBER_FORMAT

The internal default formatter for numeric duration values

Constructor Detail

DateUtils

public DateUtils()
Method Detail

formatDuration

public static String formatDuration(double duration)

Formats the specified duration in milliseconds to a human readble format. If the value is below 60 seconds it will be formatted as 'xx.xs' where 'xx' denotes the number of seconds and 's' abbreviates the second unit. If the value is above 60 seconds it will be formatted as 'yy:xxm' where 'yy' denotes the number of minutes, 'xx' the number of seconds and 'm' abbreviates the minute unit.

Parameters:
duration - the number of elapsed milliseconds
Returns:
the formatted duration