org.hermit.utils
Class TimeUtils

java.lang.Object
  extended by org.hermit.utils.TimeUtils

public class TimeUtils
extends java.lang.Object

Utilities for handling and formatting dates and times.

Author:
Ian Cameron Smith

Method Summary
static java.lang.String formatOffset(java.util.TimeZone zone)
          Produce a string describing the offset of the given time zone from UTC, including the DST offset if there is one.
static java.lang.String formatOffsetFull(java.util.TimeZone zone)
          Produce a string describing the offset of the given time zone from UTC, including the DST offset if there is one.
static java.lang.String intervalMsToHmsShort(long off)
          Format a time offset as hours, minutes and seconds, only including the relevant components.
static java.lang.String timeMsToHm(long time)
          Format a time of day in ms as hours and minutes, in 24-hour clock format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

timeMsToHm

public static java.lang.String timeMsToHm(long time)
Format a time of day in ms as hours and minutes, in 24-hour clock format.

Parameters:
time - The time in ms to format.
Returns:
The formatted value.

intervalMsToHmsShort

public static java.lang.String intervalMsToHmsShort(long off)
Format a time offset as hours, minutes and seconds, only including the relevant components. If the offset is less than 60 sec, only the seconds will be included; if the offset is an exact number of hours, only hours; etc.

Parameters:
off - The time offset in ms to format.
Returns:
The formatted value.

formatOffset

public static java.lang.String formatOffset(java.util.TimeZone zone)
Produce a string describing the offset of the given time zone from UTC, including the DST offset if there is one.

Parameters:
zone - TimeZone whose offset we want.
Returns:
Formatted offset.

formatOffsetFull

public static java.lang.String formatOffsetFull(java.util.TimeZone zone)
Produce a string describing the offset of the given time zone from UTC, including the DST offset if there is one.

Parameters:
zone - TimeZone whose offset we want.
Returns:
Formatted offset.