public enum ISO8601 extends Enum<ISO8601>
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 and Description |
---|
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).
|
Modifier and Type | Method and Description |
---|---|
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.
|
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
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 nameNullPointerException
- if the argument is nullpublic String format(long date)
date
- The date the formatpublic Date parse(String date) throws ParseException
date
- The date the formatParseException
- 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.Copyright © 2016 Allette Systems. All rights reserved.