jimm.twice.ice
Class DateTime

java.lang.Object
  extended byjimm.twice.ice.DateTime

public class DateTime
extends java.lang.Object

The DateTime class is a collection of methods that convert ICE DateTime strings into Date objects and Date objects into ICE Date, Time or DateTime strings.

ICE DateTimes are always in UTC (GMT). So are Date objects; how convenient!

Author:
Jim Menard, jimm@io.com

Field Summary
static java.util.SimpleTimeZone TZ_UTC
           
 
Constructor Summary
DateTime()
           
 
Method Summary
static java.util.Date parseICEDateTime(java.lang.String str)
          Given a string representing an ICE DateTime (which is always UTC), return a new Date object (which is also always in UTC) for that date and time.
static java.lang.String timeToICEDate()
          Returns the current time as an ICE Date string.
static java.lang.String timeToICEDate(java.util.Date date)
          Returns the specified time as an ICE Date string.
static java.lang.String timeToICEDateTime()
          Returns the current time as an ICE DateTime string including milliseconds.
static java.lang.String timeToICEDateTime(boolean includeMillisecs)
          Returns the current time as an ICE DateTime string.
static java.lang.String timeToICEDateTime(java.util.Date date)
          Returns the specified time as an ICE DateTime string including milliseconds.
static java.lang.String timeToICEDateTime(java.util.Date date, boolean includeMillisecs)
          Returns the specified time as an ICE DateTime string.
static java.lang.String timeToICETime()
          Returns the specified time as an ICE Time string including milliseconds.
static java.lang.String timeToICETime(java.util.Date date)
          Returns the specified time as an ICE Time string including milliseconds.
static java.lang.String timeToICETime(java.util.Date date, boolean includeMillisecs)
          Returns the current time as an ICE Time string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TZ_UTC

public static final java.util.SimpleTimeZone TZ_UTC
Constructor Detail

DateTime

public DateTime()
Method Detail

timeToICEDateTime

public static java.lang.String timeToICEDateTime()
Returns the current time as an ICE DateTime string including milliseconds.

Returns:
an ICE DateTime string

timeToICEDateTime

public static java.lang.String timeToICEDateTime(java.util.Date date)
Returns the specified time as an ICE DateTime string including milliseconds.

Returns:
an ICE DateTime string

timeToICEDateTime

public static java.lang.String timeToICEDateTime(boolean includeMillisecs)
Returns the current time as an ICE DateTime string. Milliseconds will be included if includeMillisecs so directs us.

Parameters:
includeMillisecs - if true, the string will include milliseconds
Returns:
an ICE DateTime string

timeToICEDateTime

public static java.lang.String timeToICEDateTime(java.util.Date date,
                                                 boolean includeMillisecs)
Returns the specified time as an ICE DateTime string. Milliseconds will be included if includeMillisecs so directs us.

Parameters:
date - a date
includeMillisecs - if true, the string will include milliseconds
Returns:
an ICE DateTime string

timeToICETime

public static java.lang.String timeToICETime()
Returns the specified time as an ICE Time string including milliseconds. be included if includeMillisecs so directs us.

Returns:
an ICE Time string

timeToICETime

public static java.lang.String timeToICETime(java.util.Date date)
Returns the specified time as an ICE Time string including milliseconds.

Parameters:
date - a date
Returns:
an ICE Time string

timeToICETime

public static java.lang.String timeToICETime(java.util.Date date,
                                             boolean includeMillisecs)
Returns the current time as an ICE Time string. Milliseconds will be included if includeMillisecs so directs us.

Parameters:
date - a date
includeMillisecs - if true, the string will include milliseconds
Returns:
an ICE Time string

timeToICEDate

public static java.lang.String timeToICEDate()
Returns the current time as an ICE Date string.

Returns:
an ICE Date string

timeToICEDate

public static java.lang.String timeToICEDate(java.util.Date date)
Returns the specified time as an ICE Date string.

Parameters:
date - a date
Returns:
an ICE Date string

parseICEDateTime

public static java.util.Date parseICEDateTime(java.lang.String str)
Given a string representing an ICE DateTime (which is always UTC), return a new Date object (which is also always in UTC) for that date and time.

Parameters:
str - an ICE DateTime string form; may include milliseconds
Returns:
a date