org.qedeq.base.utility
Class DateUtility

java.lang.Object
  extended by org.qedeq.base.utility.DateUtility

public final class DateUtility
extends java.lang.Object

Various methods for date and time handling.

Author:
Michael Meyling

Field Summary
static org.apache.commons.lang.time.FastDateFormat ISO_8601_TIME_FORMATTER
          ISO 8601 time format.
static org.apache.commons.lang.time.FastDateFormat ISO_8601_TIMESTAMP_FORMATTER
          ISO 8601 date and time format.
static org.apache.commons.lang.time.FastDateFormat NICE_TIMESTAMP_FORMATTER
          Date format YYYYMMDD HHmm.
 
Method Summary
static java.util.Date getCurrentGmtDate()
          Returns a current GMT date.
static java.util.Date getDate(long millis)
          Transform milliseconds from the epoch into date.
static java.lang.String getDuration(long milliseconds)
          Convert millisecond duration into readable time amount.
static java.lang.String getGmtTimestamp()
          Current GMT timestamp as ISO 8601 date and time separated by space.
static java.lang.String getIsoTime(long millis)
          Times in ISO 8601 format (time).
static java.lang.String getIsoTimestamp()
          Current timestamp in ISO 8601 format (date and time).
static java.lang.String getIsoTimestamp(java.util.Date date)
          Timestamp in ISO 8601 format (date and time).
static java.lang.String getIsoTimestamp(long millis)
          Timestamp in ISO 8601 format (date and time).
static java.lang.String getTimestamp()
          Current timestamp as ISO 8601 date and time separated by space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISO_8601_TIMESTAMP_FORMATTER

public static final org.apache.commons.lang.time.FastDateFormat ISO_8601_TIMESTAMP_FORMATTER
ISO 8601 date and time format.


ISO_8601_TIME_FORMATTER

public static final org.apache.commons.lang.time.FastDateFormat ISO_8601_TIME_FORMATTER
ISO 8601 time format.


NICE_TIMESTAMP_FORMATTER

public static final org.apache.commons.lang.time.FastDateFormat NICE_TIMESTAMP_FORMATTER
Date format YYYYMMDD HHmm.

Method Detail

getIsoTimestamp

public static final java.lang.String getIsoTimestamp()
Current timestamp in ISO 8601 format (date and time).

Returns:
Current timestamp.

getIsoTimestamp

public static final java.lang.String getIsoTimestamp(java.util.Date date)
Timestamp in ISO 8601 format (date and time).

Parameters:
date - Date to format.
Returns:
Timestamp.

getIsoTimestamp

public static final java.lang.String getIsoTimestamp(long millis)
Timestamp in ISO 8601 format (date and time).

Parameters:
millis - Time in UTC milliseconds from the epoch.
Returns:
Timestamp.

getIsoTime

public static final java.lang.String getIsoTime(long millis)
Times in ISO 8601 format (time).

Parameters:
millis - Time in UTC milliseconds from the epoch.
Returns:
Times.

getTimestamp

public static final java.lang.String getTimestamp()
Current timestamp as ISO 8601 date and time separated by space.

Returns:
Current timestamp.

getGmtTimestamp

public static final java.lang.String getGmtTimestamp()
Current GMT timestamp as ISO 8601 date and time separated by space.

Returns:
Current GMT timestamp.

getCurrentGmtDate

public static final java.util.Date getCurrentGmtDate()
Returns a current GMT date.

Returns:
Current GMT date.

getDuration

public static final java.lang.String getDuration(long milliseconds)
Convert millisecond duration into readable time amount.

Parameters:
milliseconds - Duration in milliseconds.
Returns:
Time in format "[d day[s] ]HH:mm:ss.SSS".

getDate

public static final java.util.Date getDate(long millis)
Transform milliseconds from the epoch into date.

Parameters:
millis - Time in UTC milliseconds from the epoch.
Returns:
Date.


Copyright © 2014. All Rights Reserved.