@Singleton @Named(value="net.sf.mmm.util.date.api.Iso8601Util") public final class Iso8601UtilImpl extends Iso8601UtilLimitedImpl implements Iso8601Util
Iso8601Util interface. It does NOT use
SimpleDateFormat. All methods of this class are fast and thread-safe. getInstance()| Modifier and Type | Field and Description |
|---|---|
private static Iso8601UtilImpl |
instance |
private static TimeZone |
TZ_UTC
The UTC TimeZone.
|
private static String |
UTC_ID
The ID for UTC (Coordinated Universal Time).
|
MAX_DAY_OF_MONTH, MAX_MONTHCDI_NAME, PATTERN_ALLPATTERN_STRING_ALL, PATTERN_STRING_DATE, PATTERN_STRING_TIME, PATTERN_STRING_TIMEZONE| Constructor and Description |
|---|
Iso8601UtilImpl()
The constructor.
|
| 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. |
void |
formatDate(Date date,
boolean extended,
Appendable buffer)
This method formats the given
date 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 |
formatDateTime(Date date,
boolean extendedDate,
boolean extendedTime,
boolean extendedTimeZone,
Appendable buffer)
This method formats the given
date 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. |
static Iso8601UtilImpl |
getInstance()
This method gets the singleton instance of this
Iso8601UtilImpl. |
Calendar |
parseCalendar(String date)
This method parses the given string
date according to ISO 8601. |
void |
parseCalendar(String date,
Calendar calendar)
|
Date |
parseDate(String date)
This method parses the given string
date according to ISO 8601. |
private TimeZone |
parseTimezone(CharSequenceScanner scanner)
This method parses the timezone from the given
parser. |
formatDate, formatDate, formatDate, formatDateTime, formatDateTime, formatTime, formatTime, formatTimeZone, parseDate, parseTime, parseTimezoneOffsetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitformatDate, formatDate, formatDateTime, formatDateTime, formatTime, formatTimeZoneprivate static Iso8601UtilImpl instance
getInstance()private static final String UTC_ID
private static final TimeZone TZ_UTC
public static Iso8601UtilImpl getInstance()
Iso8601UtilImpl. Cdi.GET_INSTANCE before using.public void formatDate(Date date, boolean extended, Appendable buffer)
date as a date according to ISO
8601.formatDate in interface Iso8601UtilLimitedformatDate in class Iso8601UtilLimitedImpldate - 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.public String formatDate(Calendar calendar)
calendar as a date in the format "yyyy-MM-dd" according to
ISO 8601.formatDate in interface Iso8601Utilcalendar - is the date to format.calendar as date string.public String formatDate(Calendar calendar, boolean extended)
calendar as a date in the format "yyyy-MM-dd" according to
ISO 8601.formatDate in interface Iso8601Utilcalendar - 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.public void formatDate(Calendar calendar, boolean extended, Appendable buffer)
calendar as a date according to ISO 8601.formatDate in interface Iso8601Utilcalendar - 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.public void formatDateTime(Date date, boolean extendedDate, boolean extendedTime, boolean extendedTimeZone, Appendable buffer)
date as a date and time according to
ISO 8601.formatDateTime in interface Iso8601UtilLimitedformatDateTime in class Iso8601UtilLimitedImpldate - is the Date 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.public String formatDateTime(Calendar calendar)
calendar as a date and time in the format
"yyyy-MM-ddTHH:mm:ss±hh:mm" according to ISO 8601.formatDateTime in interface Iso8601Utilcalendar - is the date to format.calendar as date string.public String formatDateTime(Calendar calendar, boolean extendedDate, boolean extendedTime, boolean extendedTimezone)
calendar as a date and time according to ISO 8601.formatDateTime in interface Iso8601Utilcalendar - 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.public void formatDateTime(Calendar calendar, boolean extendedDate, boolean extendedTime, boolean extendedTimezone, Appendable buffer)
calendar as a date and time according to ISO 8601.formatDateTime in interface Iso8601Utilcalendar - 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.public void formatTime(Calendar calendar, boolean extended, Appendable buffer)
calendar as time according to ISO 8601.formatTime in interface Iso8601Utilcalendar - 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.public void formatTimeZone(Calendar calendar, boolean extended, Appendable buffer)
formatTimeZone in interface Iso8601Utilcalendar - 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.public Date parseDate(String date)
date according to ISO 8601.parseDate in interface Iso8601UtilLimitedparseDate in class Iso8601UtilLimitedImpldate - is the date to parse.public Calendar parseCalendar(String date)
date according to ISO 8601.parseCalendar in interface Iso8601Utildate - is the date to parse.private TimeZone parseTimezone(CharSequenceScanner scanner)
parser.scanner - is the parser pointing to the timezone or at the end of the stringnull if parser already at the end of the string.public 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.parseCalendar in interface Iso8601Utildate - is the date to parse.calendar - is the calendar where the parsed date will be set.Copyright © 2001–2015 mmm-Team. All rights reserved.