An instance of this class holds a reference internally to one printer and
one parser. It is possible that one of these may be null, in which case the
formatter cannot print/parse. This can be checked via the isPrinter()
and isParser() methods.

The underlying printer/parser can be altered to behave exactly as required
by using one of the decorator modifiers:

public
boolean
isPrinter()

Returns

The parse will use the zone and chronology specified on this formatter.

If the text contains a time zone string then that will be taken into
account in adjusting the time of day as follows.
If the withOffsetParsed() has been called, then the resulting
DateTime will have a fixed offset based on the parsed time zone.
Otherwise the resulting DateTime will have the zone of this formatter,
but the parsed zone may have caused the time to be adjusted.

Parameters

text

the text to parse

Returns

parsed value in a DateTime object

Throws

Parses a datetime from the given text, at the given position, saving the
result into the fields of the given ReadWritableInstant. If the parse
succeeds, the return value is the new text position. Note that the parse
may succeed without fully reading the text and in this case those fields
that were read will be set.

Only those fields present in the string will be changed in the specified
instant. All other fields will remain unaltered. Thus if the string only
contains a year and a month, then the day and time will be retained from
the input instant. If this is not the behaviour you want, then reset the
fields before calling this method, or use parseDateTime(String)
or parseMutableDateTime(String).

If it fails, the return value is negative, but the instant may still be
modified. To determine the position where the parse failed, apply the
one's complement operator (~) on the return value.

Throws

Parses a datetime from the given text, returning a new MutableDateTime.

The parse will use the zone and chronology specified on this formatter.

If the text contains a time zone string then that will be taken into
account in adjusting the time of day as follows.
If the withOffsetParsed() has been called, then the resulting
DateTime will have a fixed offset based on the parsed time zone.
Otherwise the resulting DateTime will have the zone of this formatter,
but the parsed zone may have caused the time to be adjusted.

Parameters

Returns

Returns a new formatter that will create a datetime with a time zone
equal to that of the offset of the parsed string.

After calling this method, a string '2004-06-09T10:20:30-08:00' will
create a datetime with a zone of -08:00 (a fixed zone, with no daylight
savings rules). If the parsed string represents a local time (no zone
offset) the parsed datetime will be in the default zone.

Returns

Returns a new formatter that will use the specified pivot year for two
digit year parsing in preference to that stored in the parser.

This setting is useful for changing the pivot year of formats built
using a pattern - forPattern(String).

When parsing, this pivot year is used.
There is no effect when printing.

The pivot year enables a two digit year to be converted to a four
digit year. The pivot represents the year in the middle of the
supported range of years. Thus the full range of years that will
be built is (pivot - 50) .. (pivot + 49).

Parameters

Returns

Returns a new formatter that will use the specified pivot year for two
digit year parsing in preference to that stored in the parser.

This setting is useful for changing the pivot year of formats built
using a pattern - forPattern(String).

When parsing, this pivot year is used. Null means no-override.
There is no effect when printing.

The pivot year enables a two digit year to be converted to a four
digit year. The pivot represents the year in the middle of the
supported range of years. Thus the full range of years that will
be built is (pivot - 50) .. (pivot + 49).