public class ICETimeFormat extends Object
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 and Description |
---|
ICETimeFormat() |
Modifier and Type | Method and Description |
---|---|
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. |
public static String format(Date date)
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".
date
- the date to be formattedpublic static Date parse(String str) throws ParseException
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 current date 11:00:00 PM (UTC) and converted to current date + 1 01:00:00 AM (GMT+2).
To conclude, this method is NOT the exact inverse of the method
format
.
str
- the string to be parsedjava.util.Date
object
containing the parsed dateParseException
- when specifying an illegally formatted stringAccess Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] KMC-CM
|
[sap.com] tc/km/frwk
|
api
|
EP-KM-CM
|
[sap.com] KMC-WPC
|
[sap.com] tc/kmc/wpc/wpcfacade
|
api
|
EP-PIN-WPC-WCM
|
Copyright 2018 SAP AG Complete Copyright Notice