com.sapportals.wcm.protocol.ice.util

Class ICETimeFormat

java.lang.Object
  extended by com.sapportals.wcm.protocol.ice.util.ICETimeFormat

public class ICETimeFormat
extends Object

Implements the time format defined in the ICE specification. This format is the Extended Format described in [ISO8601] section 5.3.1.1, with the separator as described in [ISO8601] section 4.4. Actually, it's based on a selected profile of options from ISO8601:1988 (with Technical Corrigendum 1 applied).

The format for a time string in ICE Time Format is: hh:mm:ss (or hh:mm:ss,s for sub-second granularity) where hh is the two digit hour in 24 hour notation ranging from 00 to 24 (this is not a typo), mm is the two digit minute ranging from 00 to 59, ss is the two digit seconds ranging from 00 to 59, s is the fractional part of the seconds, and the separator character is a ":" (colon). Representation for sub-second granularity follows [ISO8601] section 5.3.1.3, and thus uses a "," (comma) separator. This implementation resolves a sub-second granularity of milliseconds. Note that ISO8601 and UTC support leap seconds, therefore this implementation also supports 60, 61 and 62 seconds.

Copyright 2004 SAP AG


Constructor Summary
ICETimeFormat()
           
 
Method Summary
static String format(Date date)
          Formats the specified java.util.Date object as a string adhering to the ICE Time Format.
static Date parse(String str)
          Parses the specified string (which must be in ICE Time Format) and returns it as a java.util.Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ICETimeFormat

public ICETimeFormat()
Method Detail

format

public static String format(Date date)
Formats the specified java.util.Date object as a string adhering to the ICE Time Format.

Note, that the date will be converted to UTC (if not already in UTC) prior formatting it to the ICE Time format. This is done although the date contained in the java.util.Date object is not included in the final string. For example, the date July 1st 2002 01:00:00 AM (GMT+2) will be converted to June 30th 2002 11:00:00 PM (UTC) and returned as "23:00:00".

Parameters:
date - the date to be formatted
Returns:
a string representation in ICE Time Format

parse

public static Date parse(String str)
                  throws ParseException
Parses the specified string (which must be in ICE Time Format) and returns it as a java.util.Date object.

Note, as the string does not contain a date, the current date will be assumed before converting the resulting date to local time. For example, on a machine with local timezone GMT+2, the string "23:00:00" will be interpreted as 11:00:00 PM (UTC) and converted to 01:00:00 AM (GMT+2).

To conclude, this method is NOT the exact inverse of the method format.

Parameters:
str - the string to be parsed
Returns:
a java.util.Date object containing the parsed date
Throws:
ParseException - when specifying an illegally formatted string
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM


Copyright 2011 SAP AG Complete Copyright Notice