|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<ISO8601> org.weborganic.ox.util.ISO8601
public enum ISO8601
This class provides methods for date formatting and parsing according to ISO 8601.
It is useful for generators as XSLT uses ISO 8601 for dates.
Notation:
The capital letter T is used to separate the date and time components.
Enum Constant Summary | |
---|---|
CALENDAR_DATE
The calendar date as defined by ISO 8601, 'YYYY-MM-DD' (Example: 2003-04-01). |
|
DATETIME
The Date and time as defined by ISO 8601, 'YYYY-MM-DDThh:mm:ss'. |
|
TIME
The time of the day as defined by ISO 8601, 'hh:mm:ss' (Example: 23:59:59). |
|
WEEK_DATE
The week date as defined by ISO 8601, 'YYYY-MM-DD' (Example: 2003-W14-2). |
|
YEAR
The calendar date as defined by ISO 8601, 'YYYY' (Example: 2010). |
Method Summary | |
---|---|
String |
format(long date)
Formats the specified date for the specified ISO 8601 format. |
static String |
format(long date,
ISO8601 format)
Returns the specified date as ISO 8601 format. |
Date |
parse(String date)
Parses the specified date as the specified ISO 8601 format. |
static Date |
parseAuto(String date)
Returns the specified date as ISO 8601 format. |
static ISO8601 |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static ISO8601[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final ISO8601 YEAR
public static final ISO8601 CALENDAR_DATE
public static final ISO8601 WEEK_DATE
public static final ISO8601 TIME
public static final ISO8601 DATETIME
Method Detail |
---|
public static ISO8601[] values()
for (ISO8601 c : ISO8601.values()) System.out.println(c);
public static ISO8601 valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic String format(long date)
date
- The date the format
public Date parse(String date) throws ParseException
date
- The date the format
ParseException
- Should an error be thrown by the DateFormat.parse(String)
method.public static String format(long date, ISO8601 format)
date
- the specified date.format
- the ISO 8601 format to use.
public static Date parseAuto(String date) throws ParseException
date
- the specified date.
ParseException
- Should an error be thrown by the DateFormat.parse(String)
method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |