public class Iso8601Format extends Object
Collection of predefined format objects for ISO-8601.
All formatters are strict by default. The preferred decimal separator is the comma during printing. This configuration follows the official recommendation of ISO-8601. However, if the system property "net.time4j.format.iso.decimal.dot" is set to "true" then the dot will be used. When parsing, both comma or dot are understood.
Note: Most produced formatters ignore any format attribute change. As exception case, timezone
attributes are recognized by BASIC_DATE_TIME_OFFSET or EXTENDED_DATE_TIME_OFFSET.
| Modifier and Type | Field and Description |
|---|---|
static ChronoFormatter<PlainDate> |
BASIC_CALENDAR_DATE
Defines the basic ISO-8601-format with year, month and day
of month using the pattern "uuuuMMdd".
|
static ChronoFormatter<PlainDate> |
BASIC_DATE
Similar to
Iso8601Format.BASIC_CALENDAR_DATE but its parser can also
understand ordinal dates or week dates. |
static ChronoFormatter<PlainTimestamp> |
BASIC_DATE_TIME
Defines the basic ISO-8601-format for a composition of
calendar date and wall time with hour and minute using the pattern
"uuuuMMdd'T'HH[mm[ss[,SSSSSSSSS]]]".
|
static ChronoFormatter<Moment> |
BASIC_DATE_TIME_OFFSET
Defines the basic ISO-8601-format for a composition of
calendar date, wall time and timezone offset using the pattern
"uuuuMMdd'T'HH[mm[ss[,SSSSSSSSS]]]{offset}".
|
static ChronoFormatter<PlainDate> |
BASIC_ORDINAL_DATE
Defines the basic ISO-8601-format with year and day of year
using the pattern "uuuuDDD".
|
static ChronoFormatter<PlainTime> |
BASIC_WALL_TIME
Defines the basic ISO-8601-format for a wall time with
hour, minute and optional second using the pattern
"HH[mm[ss[,SSSSSSSSS]]]".
|
static ChronoFormatter<PlainDate> |
BASIC_WEEK_DATE
Defines the basic ISO-8601-format for a week date using
the pattern "YYYYWwwE".
|
static ChronoFormatter<PlainDate> |
EXTENDED_CALENDAR_DATE
Defines the extended ISO-8601-format with year, month and
day of month using the pattern "uuuu-MM-dd".
|
static ChronoFormatter<PlainDate> |
EXTENDED_DATE
Similar to
Iso8601Format.EXTENDED_CALENDAR_DATE but its parser can also
understand ordinal dates or week dates. |
static ChronoFormatter<PlainTimestamp> |
EXTENDED_DATE_TIME
Defines the extended ISO-8601-format for a composition of
calendar date and wall time with hour and minute using the pattern
"uuuu-MM-dd'T'HH[:mm[:ss[,SSSSSSSSS]]]".
|
static ChronoFormatter<Moment> |
EXTENDED_DATE_TIME_OFFSET
Defines the extended ISO-8601-format for a composition of
calendar date, wall time and timezone offset using the pattern
"uuuu-MM-dd'T'HH[:mm[:ss[,SSSSSSSSS]]]{offset}".
|
static ChronoFormatter<PlainDate> |
EXTENDED_ORDINAL_DATE
Defines the extended ISO-8601-format with year and day
of year using the pattern "uuuu-DDD".
|
static ChronoFormatter<PlainTime> |
EXTENDED_WALL_TIME
Defines the extended ISO-8601-format for a wall time
with hour, minute and optional second using the pattern
"HH[:mm[:ss[,SSSSSSSSS]]]".
|
static ChronoFormatter<PlainDate> |
EXTENDED_WEEK_DATE
Defines the extended ISO-8601-format for a week date
using the pattern "YYYY-Www-E".
|
| Modifier and Type | Method and Description |
|---|---|
static PlainDate |
parseDate(CharSequence iso)
Parses given ISO-8601-compatible date string in basic or extended format.
|
static PlainDate |
parseDate(CharSequence iso,
ParseLog plog)
Parses given ISO-8601-compatible date string in basic or extended format.
|
public static final ChronoFormatter<PlainDate> BASIC_CALENDAR_DATE
Defines the basic ISO-8601-format with year, month and day of month using the pattern "uuuuMMdd".
public static final ChronoFormatter<PlainDate> EXTENDED_CALENDAR_DATE
Defines the extended ISO-8601-format with year, month and day of month using the pattern "uuuu-MM-dd".
public static final ChronoFormatter<PlainDate> BASIC_ORDINAL_DATE
Defines the basic ISO-8601-format with year and day of year using the pattern "uuuuDDD".
public static final ChronoFormatter<PlainDate> EXTENDED_ORDINAL_DATE
Defines the extended ISO-8601-format with year and day of year using the pattern "uuuu-DDD".
public static final ChronoFormatter<PlainDate> BASIC_WEEK_DATE
Defines the basic ISO-8601-format for a week date using the pattern "YYYYWwwE".
public static final ChronoFormatter<PlainDate> EXTENDED_WEEK_DATE
Defines the extended ISO-8601-format for a week date using the pattern "YYYY-Www-E".
public static final ChronoFormatter<PlainDate> BASIC_DATE
Similar to Iso8601Format.BASIC_CALENDAR_DATE but its parser can also
understand ordinal dates or week dates.
public static final ChronoFormatter<PlainDate> EXTENDED_DATE
Similar to Iso8601Format.EXTENDED_CALENDAR_DATE but its parser can also
understand ordinal dates or week dates.
public static final ChronoFormatter<PlainTime> BASIC_WALL_TIME
Defines the basic ISO-8601-format for a wall time with hour, minute and optional second using the pattern "HH[mm[ss[,SSSSSSSSS]]]".
The minute part is optional during parsing, but will always be printed. The parser also accepts a leading char T.
public static final ChronoFormatter<PlainTime> EXTENDED_WALL_TIME
Defines the extended ISO-8601-format for a wall time with hour, minute and optional second using the pattern "HH[:mm[:ss[,SSSSSSSSS]]]".
The minute part is optional during parsing, but will always be printed. The parser also accepts a leading char T.
public static final ChronoFormatter<PlainTimestamp> BASIC_DATE_TIME
Defines the basic ISO-8601-format for a composition of calendar date and wall time with hour and minute using the pattern "uuuuMMdd'T'HH[mm[ss[,SSSSSSSSS]]]".
Second and nanosecond elements are optional. Furthermore, the count of decimal digits is flexible (0-9). The minute part is optional during parsing, but will always be printed. The parser will also understand a combination of ordinal date or week date together with the wall time.
public static final ChronoFormatter<PlainTimestamp> EXTENDED_DATE_TIME
Defines the extended ISO-8601-format for a composition of calendar date and wall time with hour and minute using the pattern "uuuu-MM-dd'T'HH[:mm[:ss[,SSSSSSSSS]]]".
Second and nanosecond elements are optional. Furthermore, the count of decimal digits is flexible (0-9). The minute part is optional during parsing, but will always be printed. The parser will also understand a combination of ordinal date or week date together with the wall time.
public static final ChronoFormatter<Moment> BASIC_DATE_TIME_OFFSET
Defines the basic ISO-8601-format for a composition of calendar date, wall time and timezone offset using the pattern "uuuuMMdd'T'HH[mm[ss[,SSSSSSSSS]]]{offset}".
Second and nanosecond elements are optional. Furthermore, the count of decimal digits is flexible (0-9). The minute part is optional during parsing, but will always be printed. The offset part is for printing equivalent to XX, for parsing equivalent to X. The parser will also understand a combination of ordinal date or week date together with the wall time.
By default, the timezone offset used for printing is UTC+00:00.
Users can override this offset by calling the method
ChronoFormatter.withTimezone(net.time4j.tz.TZID).
public static final ChronoFormatter<Moment> EXTENDED_DATE_TIME_OFFSET
Defines the extended ISO-8601-format for a composition of calendar date, wall time and timezone offset using the pattern "uuuu-MM-dd'T'HH[:mm[:ss[,SSSSSSSSS]]]{offset}".
Second and nanosecond elements are optional. Furthermore, the count of decimal digits is flexible (0-9). The minute part is optional during parsing, but will always be printed. The offset part is for printing equivalent to XXX, for parsing equivalent to X (but with colon!). The parser will also understand a combination of ordinal date or week date together with the wall time.
By default, the timezone offset used for printing is UTC+00:00.
Users can override this offset by calling the method
ChronoFormatter.withTimezone(net.time4j.tz.TZID).
public static PlainDate parseDate(CharSequence iso) throws ParseException
Parses given ISO-8601-compatible date string in basic or extended format.
iso - text like "20160101", "2016001", "2016W011",
"2016-01-01", "2016-001" or "2016-W01-1"ParseException - if parsing fails for any reasonpublic static PlainDate parseDate(CharSequence iso, ParseLog plog)
Parses given ISO-8601-compatible date string in basic or extended format.
iso - text like "20160101", "2016001", "2016W011",
"2016-01-01", "2016-001" or "2016-W01-1"plog - new mutable instance of ParseLognull in case of errorIndexOutOfBoundsException - if the start position is at end of text or even behindParseLog.isError()Copyright © 2014–2017. All rights reserved.