Deprecated
adoption of the new date/time API means formatting is now supported via java.
Creates DateFormat objects optimized for common iCalendar date patterns.
getInstance(String)
| Modifier and Type | Class and Description |
|---|---|
| private abstract static class | |
| private static class | CalendarDateFormatFactory.
Custom date formatter. |
| private static class | CalendarDateFormatFactory.
A custom date-time formatter. |
| private static class | CalendarDateFormatFactory.
Custom time formatter. |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final String | |
| private static final String | |
| private static final Logger | |
| private static final String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public static DateFormat | Returns: an optimized DateFormat instance if possible, otherwise a normal SimpleDateFormat instancea SimpleDateFormat-compatible pattern pattern)Returns DateFormat objects optimized for common iCalendar date patterns. |
| private static Calendar | makeCalendar(boolean lenient, TimeZone timeZone, int year, int zeroBasedMonth, int day, int hour, int minutes, int seconds)
|
| private static Calendar |
| DATE_PATTERN | back to summary |
|---|---|
| private static final String DATE_PATTERN | |
| DATETIME_PATTERN | back to summary |
|---|---|
| private static final String DATETIME_PATTERN | |
| DATETIME_UTC_PATTERN | back to summary |
|---|---|
| private static final String DATETIME_UTC_PATTERN | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| TIME_PATTERN | back to summary |
|---|---|
| private static final String TIME_PATTERN | |
| TIME_UTC_PATTERN | back to summary |
|---|---|
| private static final String TIME_UTC_PATTERN | |
| CalendarDateFormatFactory | back to summary |
|---|---|
| private CalendarDateFormatFactory() Constructor made private to enforce static nature. | |
| appendPadded | back to summary |
|---|---|
| private static void appendPadded(StringBuffer toAppendTo, int value, int fieldWidth) | |
| getInstance | back to summary |
|---|---|
| public static DateFormat getInstance(String pattern) Returns DateFormat objects optimized for common iCalendar date patterns. The DateFormats are *not* thread safe. Attempts to get or set the Calendar or NumberFormat of an optimized DateFormat will result in an UnsupportedOperation exception being thrown.
| |
| makeCalendar | back to summary |
|---|---|
| private static Calendar makeCalendar(boolean lenient, TimeZone timeZone, int year, int zeroBasedMonth, int day, int hour, int minutes, int seconds) | |
| makeCalendar | back to summary |
|---|---|
| private static Calendar makeCalendar(boolean lenient, TimeZone timeZone, int year, int month, int day) | |
| Modifier and Type | Field and Description |
|---|---|
| private static final TimeZone | |
| private boolean | |
| private final String | |
| private static final long | |
| private TimeZone |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| public boolean | equals(Object
object to be compared for equality o)Overrides java. Compares the specified object with this |
| public Calendar | getCalendar()
Overrides java. Gets the calendar associated with this date/time formatter. |
| public NumberFormat | getNumberFormat()
Overrides java. Gets the number formatter which this date/time formatter uses to format and parse a time. |
| public TimeZone | |
| public int | |
| public boolean | isLenient()
Overrides java. Tell whether date/time parsing is to be lenient. |
| public void | setCalendar(Calendar
the new c)Calendar to be used by the date formatOverrides java. Set the calendar to be used by this date format. |
| public void | setLenient(boolean
when lenient)true, parsing is lenientOverrides java. Specify whether or not date/time parsing is to be lenient. |
| public void | setNumberFormat(NumberFormat
the given new NumberFormat. n)Overrides java. Allows you to set the number formatter. |
| public void | setTimeZone(TimeZone
the given new time zone. tz)Overrides java. Sets the time zone for the calendar of this |
| DEFAULT_TIME_ZONE | back to summary |
|---|---|
| private static final TimeZone DEFAULT_TIME_ZONE | |
| lenient | back to summary |
|---|---|
| private boolean lenient | |
| pattern | back to summary |
|---|---|
| private final String pattern | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| timeZone | back to summary |
|---|---|
| private TimeZone timeZone | |
| CalendarDateFormat | back to summary |
|---|---|
| public CalendarDateFormat(String pattern) | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Doc from java. Overrides Cloneable
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Compares the specified object with this | |
| getCalendar | back to summary |
|---|---|
| public Calendar getCalendar() Overrides java. Doc from java. Gets the calendar associated with this date/time formatter. | |
| getNumberFormat | back to summary |
|---|---|
| public NumberFormat getNumberFormat() Overrides java. Doc from java. Gets the number formatter which this date/time formatter uses to format and parse a time.
| |
| getTimeZone | back to summary |
|---|---|
| public TimeZone getTimeZone() Overrides java. Doc from java. Gets the time zone. This method is equivalent to the following call.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns the hash code for this
| |
| isLenient | back to summary |
|---|---|
| public boolean isLenient() Overrides java. Doc from java. Tell whether date/time parsing is to be lenient. This method is equivalent to the following call.
| |
| setCalendar | back to summary |
|---|---|
| public void setCalendar(Calendar c) Overrides java. Doc from java. Set the calendar to be used by this date format. Initially, the default calendar for the specified or default locale is used. Any | |
| setLenient | back to summary |
|---|---|
| public void setLenient(boolean lenient) Overrides java. Doc from java. Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object's format. With strict parsing, inputs must match this object's format. This method is equivalent to the following call.
This leniency value is overwritten by a call to
| |
| setNumberFormat | back to summary |
|---|---|
| public void setNumberFormat(NumberFormat n) Overrides java. Doc from java. Allows you to set the number formatter.
| |
| setTimeZone | back to summary |
|---|---|
| public void setTimeZone(TimeZone tz) Overrides java. Doc from java. Sets the time zone for the calendar of this
The The | |
yyyyMMdd
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StringBuffer | format(Date
a Date to be formatted into a date-time string. date, StringBuffer the string buffer for the returning date-time string. toAppendTo, FieldPosition keeps track on the position of the field within
the returned string. For example, given a date-time text
fieldPosition)"1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition
is DateFormat#YEAR_FIELD, the begin index and end index of
fieldPosition will be set to 0 and 4, respectively.
Notice that if the same date-time field appears more than once in a
pattern, the fieldPosition will be set for the first occurrence
of that date-time field. For instance, formatting a Date to the
date-time string "1 PM PDT (Pacific Daylight Time)" using the
pattern "h a z (zzzz)" and the alignment field
DateFormat#TIMEZONE_FIELD, the begin index and end index of
fieldPosition will be set to 5 and 8, respectively, for the
first occurrence of the timezone pattern character 'z'.Implements abstract java. Formats a |
| public Date | parse(String
The date/time string to be parsed source, ParsePosition On input, the position at which to start parsing; on
output, the position at which parsing terminated, or the
start position if the parse failed. pos)Implements abstract java. Parse a date/time string according to the given parse position. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides net. | |
| DateFormat | back to summary |
|---|---|
| public DateFormat(String pattern) | |
| format | back to summary |
|---|---|
| public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) Implements abstract java. Doc from java. Formats a
| |
| parse | back to summary |
|---|---|
| public Date parse(String source, ParsePosition pos) Implements abstract java. Doc from java. Parse a date/time string according to the given parse position. For
example, if By default, parsing is lenient: If the input is not in the form used
by this object's format method but can still be parsed as a date, then
the parse succeeds. Clients may insist on strict adherence to the
format by calling This parsing operation uses the
| |
yyyyMMdd'T'HHmmss yyyyMMdd'T'HHmmss'Z'
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StringBuffer | format(Date
a Date to be formatted into a date-time string. date, StringBuffer the string buffer for the returning date-time string. toAppendTo, FieldPosition keeps track on the position of the field within
the returned string. For example, given a date-time text
fieldPosition)"1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition
is DateFormat#YEAR_FIELD, the begin index and end index of
fieldPosition will be set to 0 and 4, respectively.
Notice that if the same date-time field appears more than once in a
pattern, the fieldPosition will be set for the first occurrence
of that date-time field. For instance, formatting a Date to the
date-time string "1 PM PDT (Pacific Daylight Time)" using the
pattern "h a z (zzzz)" and the alignment field
DateFormat#TIMEZONE_FIELD, the begin index and end index of
fieldPosition will be set to 5 and 8, respectively, for the
first occurrence of the timezone pattern character 'z'.Implements abstract java. Formats a |
| public Date | parse(String
The date/time string to be parsed source, ParsePosition On input, the position at which to start parsing; on
output, the position at which parsing terminated, or the
start position if the parse failed. pos)Implements abstract java. Parse a date/time string according to the given parse position. |
| patternEndsWithZ | back to summary |
|---|---|
| pack-priv final boolean patternEndsWithZ | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides net. | |
| DateTimeFormat | back to summary |
|---|---|
| public DateTimeFormat(String pattern) | |
| format | back to summary |
|---|---|
| public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) Implements abstract java. Doc from java. Formats a
| |
| parse | back to summary |
|---|---|
| public Date parse(String source, ParsePosition pos) Implements abstract java. Doc from java. Parse a date/time string according to the given parse position. For
example, if By default, parsing is lenient: If the input is not in the form used
by this object's format method but can still be parsed as a date, then
the parse succeeds. Clients may insist on strict adherence to the
format by calling This parsing operation uses the
| |
HHmmss HHmmss'Z'
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StringBuffer | format(Date
a Date to be formatted into a date-time string. date, StringBuffer the string buffer for the returning date-time string. toAppendTo, FieldPosition keeps track on the position of the field within
the returned string. For example, given a date-time text
fieldPosition)"1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition
is DateFormat#YEAR_FIELD, the begin index and end index of
fieldPosition will be set to 0 and 4, respectively.
Notice that if the same date-time field appears more than once in a
pattern, the fieldPosition will be set for the first occurrence
of that date-time field. For instance, formatting a Date to the
date-time string "1 PM PDT (Pacific Daylight Time)" using the
pattern "h a z (zzzz)" and the alignment field
DateFormat#TIMEZONE_FIELD, the begin index and end index of
fieldPosition will be set to 5 and 8, respectively, for the
first occurrence of the timezone pattern character 'z'.Implements abstract java. Formats a |
| public Date | parse(String
The date/time string to be parsed source, ParsePosition On input, the position at which to start parsing; on
output, the position at which parsing terminated, or the
start position if the parse failed. pos)Implements abstract java. Parse a date/time string according to the given parse position. |
| patternEndsWithZ | back to summary |
|---|---|
| pack-priv final boolean patternEndsWithZ | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides net. | |
| TimeFormat | back to summary |
|---|---|
| public TimeFormat(String pattern) | |
| format | back to summary |
|---|---|
| public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) Implements abstract java. Doc from java. Formats a
| |
| parse | back to summary |
|---|---|
| public Date parse(String source, ParsePosition pos) Implements abstract java. Doc from java. Parse a date/time string according to the given parse position. For
example, if By default, parsing is lenient: If the input is not in the form used
by this object's format method but can still be parsed as a date, then
the parse succeeds. Clients may insist on strict adherence to the
format by calling This parsing operation uses the
| |