@ComponentSpecification public interface Iso8601Util extends Iso8601UtilLimited
| Type | Basic | Extended | Special |
|---|---|---|---|
| Date | yyyyMMdd | yyyy-MM-dd | |
| Time | HHmmss | HH:mm:ss | |
| Timezone | ±HH[mm[ss]] | ±HH[:mm[:ss]] | 'Z' |
Z means UTC. parse methods support all formats described above. For
formatting various methods exist for different format combinations. java.time where everything is build in and APIs are clean.Iso8601UtilImpl| Modifier and Type | Field and Description |
|---|---|
static Pattern |
PATTERN_ALL
The regex-pattern to check the format.
|
PATTERN_STRING_ALL, PATTERN_STRING_DATE, PATTERN_STRING_TIME, PATTERN_STRING_TIMEZONE| Modifier and Type | Method and Description |
|---|---|
String |
formatDate(Calendar calendar)
This method formats the given
calendar as a date in the format "yyyy-MM-dd" according to
ISO 8601. |
String |
formatDate(Calendar calendar,
boolean extended)
This method formats the given
calendar as a date in the format "yyyy-MM-dd" according to
ISO 8601. |
void |
formatDate(Calendar calendar,
boolean extended,
Appendable buffer)
This method formats the given
calendar as a date according to ISO 8601. |
String |
formatDateTime(Calendar calendar)
This method formats the given
calendar as a date and time in the format
"yyyy-MM-ddTHH:mm:ss±hh:mm" according to ISO 8601. |
String |
formatDateTime(Calendar calendar,
boolean extendedDate,
boolean extendedTime,
boolean extendedTimezone)
This method formats the given
calendar as a date and time according to ISO
8601. |
void |
formatDateTime(Calendar calendar,
boolean extendedDate,
boolean extendedTime,
boolean extendedTimezone,
Appendable buffer)
This method formats the given
calendar as a date and time according to ISO
8601. |
void |
formatTime(Calendar calendar,
boolean extended,
Appendable buffer)
This method formats the given
calendar as time according to ISO 8601. |
void |
formatTimeZone(Calendar calendar,
boolean extended,
Appendable buffer)
This method formats the given
timezone according to ISO 8601. |
Calendar |
parseCalendar(String date)
This method parses the given string
date according to ISO 8601. |
void |
parseCalendar(String date,
Calendar calendar)
|
formatDate, formatDate, formatDate, formatDateTime, formatDateTime, formatDateTime, formatTime, formatTimeZone, parseDatestatic final Pattern PATTERN_ALL
String formatDate(Calendar calendar)
calendar as a date in the format "yyyy-MM-dd" according to
ISO 8601.calendar - is the date to format.calendar as date string.String formatDate(Calendar calendar, boolean extended)
calendar as a date in the format "yyyy-MM-dd" according to
ISO 8601.calendar - is the date to format.extended - if false the basic format ("yyyyMMdd") is used, if true the extended
format ("yyyy-MM-dd") is used.calendar as date string.void formatDate(Calendar calendar, boolean extended, Appendable buffer)
calendar as a date according to ISO 8601.calendar - is the date to format.extended - if false the basic date format ("yyyyMMdd") is used, if true the extended
date format ("yyyy-MM-dd") is used.buffer - is where to append the formatted date.String formatDateTime(Calendar calendar)
calendar as a date and time in the format
"yyyy-MM-ddTHH:mm:ss±hh:mm" according to ISO 8601.calendar - is the date to format.calendar as date string.String formatDateTime(Calendar calendar, boolean extendedDate, boolean extendedTime, boolean extendedTimezone)
calendar as a date and time according to ISO
8601.calendar - is the Calendar to format.extendedDate - if false the basic date format ("yyyyMMdd") is used, if true the
extended date format ("yyyy-MM-dd") is used.extendedTime - if false the basic time format ("HHmmss") is used, if true the
extended time format ("HH:mm:ss") is used.extendedTimezone - if false the basic timezone format ("±HHmm[ss]") is used, if
true the extended timezone format ("±HH:mm[:ss]") is used.calendar as date string.void formatDateTime(Calendar calendar, boolean extendedDate, boolean extendedTime, boolean extendedTimezone, Appendable buffer)
calendar as a date and time according to ISO
8601.calendar - is the Calendar to format.extendedDate - if false the basic date format ("yyyyMMdd") is used, if true the
extended date format ("yyyy-MM-dd") is used.extendedTime - if false the basic time format ("HHmmss") is used, if true the
extended time format ("HH:mm:ss") is used.extendedTimezone - if false the basic timezone format ("±HHmm[ss]") is used, if
true the extended timezone format ("±HH:mm[:ss]") is used.buffer - is where to append the formatted date and time.void formatTime(Calendar calendar, boolean extended, Appendable buffer)
calendar as time according to ISO 8601.calendar - is the Calendar to format.extended - if false the basic time format ("HHmmss") is used, if true the extended
time format ("HH:mm:ss") is used.buffer - is where to append the formatted date.void formatTimeZone(Calendar calendar, boolean extended, Appendable buffer)
calendar - is the Calendar to format.extended - - if false the basic timezone format ("±HHmm[ss]") is used, if true
the extended timezone format ("±HH:mm[:ss]") is used.buffer - is where to append the formatted timezone.Calendar parseCalendar(String date)
date according to ISO 8601.date - is the date to parse.void parseCalendar(String date, Calendar calendar)
date according to ISO 8601 using the given
calendar. If the given date does NOT specify the time or timezone, the values from the
given calendar will be kept.date - is the date to parse.calendar - is the calendar where the parsed date will be set.Copyright © 2001–2016 mmm-Team. All rights reserved.