|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
java.text.DateFormat
com.skaringa.util.ISO8601DateTimeFormat
public class ISO8601DateTimeFormat
Format and parse an ISO 8601 DateTimeFormat used in XML documents. This lexical representation is the ISO 8601 extended format CCYY-MM-DDThh:mm:ss where "CC" represents the century, "YY" the year, "MM" the month and "DD" the day, preceded by an optional leading "-" sign to indicate a negative number. If the sign is omitted, "+" is assumed. The letter "T" is the date/time separator and "hh", "mm", "ss" represent hour, minute and second respectively. This representation may be immediately followed by a "Z" to indicate Coordinated Universal Time (UTC) or, to indicate the time zone, i.e. the difference between the local time and Coordinated Universal Time, immediately followed by a sign, + or -, followed by the difference from UTC represented as hh:mm.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.DateFormat |
---|
java.text.DateFormat.Field |
Field Summary |
---|
Fields inherited from class java.text.DateFormat |
---|
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD |
Constructor Summary | |
---|---|
ISO8601DateTimeFormat()
Construct a new ISO8601DateTimeFormat using the default time zone. |
|
ISO8601DateTimeFormat(java.util.TimeZone tz)
Construct a new ISO8601DateTimeFormat using a specific time zone. |
Method Summary | |
---|---|
protected void |
appendInt(java.lang.StringBuffer buf,
int value,
int length)
Write an integer value with leading zeros. |
java.lang.StringBuffer |
format(java.util.Date date,
java.lang.StringBuffer sbuf,
java.text.FieldPosition fieldPosition)
|
java.util.Date |
parse(java.lang.String text,
java.text.ParsePosition pos)
|
protected int |
parseTZ(int i,
java.lang.String text)
Parse the time zone. |
protected void |
writeCCYYMM(java.lang.StringBuffer sbuf)
Write century, year, and months. |
protected void |
writehhmmss(java.lang.StringBuffer sbuf)
Write hour, minutes, and seconds. |
protected void |
writeTZ(java.lang.StringBuffer sbuf)
Write the time zone string. |
Methods inherited from class java.text.DateFormat |
---|
clone, equals, format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, hashCode, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone |
Methods inherited from class java.text.Format |
---|
format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ISO8601DateTimeFormat()
public ISO8601DateTimeFormat(java.util.TimeZone tz)
tz
- The time zone used to format and parse the date.Method Detail |
---|
public java.util.Date parse(java.lang.String text, java.text.ParsePosition pos)
parse
in class java.text.DateFormat
DateFormat.parse(String, ParsePosition)
protected final int parseTZ(int i, java.lang.String text)
i
- The position to start parsing.text
- The text to parse.
public java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer sbuf, java.text.FieldPosition fieldPosition)
format
in class java.text.DateFormat
DateFormat.format(Date, StringBuffer, FieldPosition)
protected final void writeTZ(java.lang.StringBuffer sbuf)
sbuf
- The buffer to append the time zone.protected final void writehhmmss(java.lang.StringBuffer sbuf)
sbuf
- The buffer to append the string.protected final void writeCCYYMM(java.lang.StringBuffer sbuf)
sbuf
- The buffer to append the string.protected final void appendInt(java.lang.StringBuffer buf, int value, int length)
buf
- The buffer to append the string.value
- The value to write.length
- The length of the string to write.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |