public class StdDateFormat extends DateFormat
DateFormat
implementation used by standard Date
serializers and deserializers. For serialization defaults to using
an ISO-8601 compliant format (format String "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
and for deserialization, both ISO-8601 and RFC-1123.DateFormat.Field
Modifier and Type | Field and Description |
---|---|
protected DateFormat |
_formatISO8601 |
protected DateFormat |
_formatISO8601_z |
protected DateFormat |
_formatPlain |
protected DateFormat |
_formatRFC1123 |
protected TimeZone |
_timezone
Caller may want to explicitly override timezone to use; if so,
we will have non-null value here.
|
protected static String[] |
ALL_FORMATS
For error messages we'll also need a list of all formats.
|
protected static DateFormat |
DATE_FORMAT_ISO8601 |
protected static DateFormat |
DATE_FORMAT_ISO8601_Z |
protected static DateFormat |
DATE_FORMAT_PLAIN |
protected static DateFormat |
DATE_FORMAT_RFC1123 |
protected static String |
DATE_FORMAT_STR_ISO8601
Defines a commonly used date format that conforms
to ISO-8601 date formatting standard, when it includes basic undecorated
timezone definition
|
protected static String |
DATE_FORMAT_STR_ISO8601_Z
Same as 'regular' 8601, but handles 'Z' as an alias for "+0000"
(or "GMT")
|
protected static String |
DATE_FORMAT_STR_PLAIN
ISO-8601 with just the Date part, no time
|
protected static String |
DATE_FORMAT_STR_RFC1123
This constant defines the date format specified by
RFC 1123 / RFC 822.
|
static StdDateFormat |
instance
A singleton instance can be used for cloning purposes.
|
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
Constructor and Description |
---|
StdDateFormat() |
StdDateFormat(TimeZone tz) |
Modifier and Type | Method and Description |
---|---|
StdDateFormat |
clone() |
StringBuffer |
format(Date date,
StringBuffer toAppendTo,
FieldPosition fieldPosition) |
static DateFormat |
getBlueprintISO8601Format()
Method for getting the globally shared DateFormat instance
that uses GMT timezone and can handle simple ISO-8601
compliant date format.
|
static DateFormat |
getBlueprintRFC1123Format()
Method for getting the globally shared DateFormat instance
that uses GMT timezone and can handle RFC-1123
compliant date format.
|
static TimeZone |
getDefaultTimeZone() |
static DateFormat |
getISO8601Format(TimeZone tz)
Method for getting a non-shared DateFormat instance
that uses specified timezone and can handle simple ISO-8601
compliant date format.
|
static DateFormat |
getRFC1123Format(TimeZone tz)
Method for getting a non-shared DateFormat instance
that uses specific timezone and can handle RFC-1123
compliant date format.
|
protected boolean |
looksLikeISO8601(String dateStr)
Overridable helper method used to figure out which of supported
formats is the likeliest match.
|
Date |
parse(String dateStr) |
Date |
parse(String dateStr,
ParsePosition pos) |
protected Date |
parseAsISO8601(String dateStr,
ParsePosition pos) |
protected Date |
parseAsRFC1123(String dateStr,
ParsePosition pos) |
void |
setTimeZone(TimeZone tz) |
StdDateFormat |
withTimeZone(TimeZone tz)
Method used for creating a new instance with specified timezone;
if no timezone specified, defaults to the default timezone (UTC).
|
equals, format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, hashCode, isLenient, parseObject, setCalendar, setLenient, setNumberFormat
format, formatToCharacterIterator, parseObject
protected static final String DATE_FORMAT_STR_ISO8601
protected static final String DATE_FORMAT_STR_ISO8601_Z
protected static final String DATE_FORMAT_STR_PLAIN
protected static final String DATE_FORMAT_STR_RFC1123
protected static final String[] ALL_FORMATS
protected static final DateFormat DATE_FORMAT_RFC1123
protected static final DateFormat DATE_FORMAT_ISO8601
protected static final DateFormat DATE_FORMAT_ISO8601_Z
protected static final DateFormat DATE_FORMAT_PLAIN
public static final StdDateFormat instance
protected transient TimeZone _timezone
protected transient DateFormat _formatRFC1123
protected transient DateFormat _formatISO8601
protected transient DateFormat _formatISO8601_z
protected transient DateFormat _formatPlain
public StdDateFormat()
public StdDateFormat(TimeZone tz)
public static TimeZone getDefaultTimeZone()
public StdDateFormat withTimeZone(TimeZone tz)
public StdDateFormat clone()
clone
in class DateFormat
public static DateFormat getBlueprintISO8601Format()
public static DateFormat getISO8601Format(TimeZone tz)
public static DateFormat getBlueprintRFC1123Format()
public static DateFormat getRFC1123Format(TimeZone tz)
public void setTimeZone(TimeZone tz)
setTimeZone
in class DateFormat
public Date parse(String dateStr) throws ParseException
parse
in class DateFormat
ParseException
public Date parse(String dateStr, ParsePosition pos)
parse
in class DateFormat
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
format
in class DateFormat
protected boolean looksLikeISO8601(String dateStr)
protected Date parseAsISO8601(String dateStr, ParsePosition pos)
protected Date parseAsRFC1123(String dateStr, ParsePosition pos)
Copyright © 2012 FasterXML. All Rights Reserved.