Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.util

public Class ISO8601DateFormat

extends DateFormat
Class Inheritance
Annotations
@Deprecated
Imports
java.text.*, java.util.Date, .GregorianCalendar

Deprecated

Use com.fasterxml.jackson.databind.util.StdDateFormat instead

Provide a fast thread-safe formatter/parser DateFormat for ISO8601 dates ONLY. It was mainly done to be used with Jackson JSON Processor.

Watch out for clone implementation that returns itself.

All other methods but parse and format and clone are undefined behavior.

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from java.text.DateFormat:
AM_PM_FIELDcalendarDATE_FIELDDAY_OF_WEEK_FIELDDAY_OF_WEEK_IN_MONTH_FIELDDAY_OF_YEAR_FIELDDEFAULTERA_FIELDFULLHOUR0_FIELDHOUR1_FIELDHOUR_OF_DAY0_FIELDHOUR_OF_DAY1_FIELDLONGMEDIUMMILLISECOND_FIELDMINUTE_FIELDMONTH_FIELDnumberFormatSECOND_FIELDSHORTTIMEZONE_FIELDWEEK_OF_MONTH_FIELDWEEK_OF_YEAR_FIELDYEAR_FIELD

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.text.DateFormat.clone.

Overrides Cloneable

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 "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'.
fieldPosition
)

Implements abstract java.text.DateFormat.format.

Formats a Date into a date-time string.

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.text.DateFormat.parse.

Parse a date/time string according to the given parse position.

public Date
parse(String
A String whose beginning should be parsed.
source
)

Overrides java.text.DateFormat.parse.

Parses text from the beginning of the given string to produce a date.

Inherited from java.text.DateFormat:
equalsformatformatgetAvailableLocalesgetCalendargetDateInstancegetDateInstancegetDateInstancegetDateTimeInstancegetDateTimeInstancegetDateTimeInstancegetInstancegetNumberFormatgetTimeInstancegetTimeInstancegetTimeInstancegetTimeZonehashCodeisLenientparseObjectsetCalendarsetLenientsetNumberFormatsetTimeZone

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.text.DateFormat.serialVersionUID.

Constructor Detail

ISO8601DateFormatback to summary
public ISO8601DateFormat()

Method Detail

cloneback to summary
public Object clone()

Overrides java.text.DateFormat.clone.

Doc from java.text.DateFormat.clone.

Overrides Cloneable

Returns:Object

Doc from java.text.Format.clone.

a clone of this instance.

Annotations
@Override
formatback to summary
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)

Implements abstract java.text.DateFormat.format.

Doc from java.text.DateFormat.format.

Formats a Date into a date-time string. The formatted string is appended to the given StringBuffer.

Parameters
date:Date

a Date to be formatted into a date-time string.

toAppendTo:StringBuffer

the string buffer for the returning date-time string.

fieldPosition:FieldPosition

keeps track on the position of the field within the returned string. For example, given a date-time text "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'.

Returns:StringBuffer

the string buffer passed in as toAppendTo, with formatted text appended.

Annotations
@Override
parseback to summary
public Date parse(String source, ParsePosition pos)

Implements abstract java.text.DateFormat.parse.

Doc from java.text.DateFormat.parse.

Parse a date/time string according to the given parse position. For example, if this has the pattern "M/d/yy h:m a, z", then a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date that is equivalent to Date(837039900000L).

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 setLenient(false).

This parsing operation uses the calendar to produce a Date. As a result, the calendar's date-time fields and the TimeZone value may have been overwritten, depending on subclass implementations. Any TimeZone value that has previously been set by a call to setTimeZone may need to be restored for further operations.

Parameters
source:String

The date/time string to be parsed

pos: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.

Returns:Date

A Date, or null if the input could not be parsed

Annotations
@Override
parseback to summary
public Date parse(String source) throws ParseException

Overrides java.text.DateFormat.parse.

Doc from java.text.DateFormat.parse.

Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string.

See the parse(String, ParsePosition) method for more information on date parsing.

Parameters
source:String

A String whose beginning should be parsed.

Returns:Date

A Date parsed from the string.

Annotations
@Override
Exceptions
ParseException:
if the beginning of the specified string cannot be parsed.