Joda Time API

org.joda.time.format
Class DateTimeFormatterBuilder

java.lang.Object
  |
  +--org.joda.time.format.DateTimeFormatterBuilder

public class DateTimeFormatterBuilder
extends java.lang.Object

DateTimeFormatterBuilder is used for constructing DateTimeFormatters. DateTimeFormatters can be built by appending specific fields, patterns, or other formatters.

For example, a formatter that prints month and year, like "January 1970", can be constructed as follows:

 DateTimeFormatter monthAndYear = new DateTimeFormatterBuilder()
     .appendMonthOfYearText()
     .appendLiteral(' ')
     .appendYear(4, 4)
     .toFormatter();
 

Author:
Brian S O'Neill
See Also:
DateTimeFormat

Constructor Summary
DateTimeFormatterBuilder()
          Creates a DateTimeFormatterBuilder with ISOChronology, in the default time zone and locale.
DateTimeFormatterBuilder(Chronology chrono)
          Creates a DateTimeFormatterBuilder with any chronology and the default locale.
DateTimeFormatterBuilder(Chronology chrono, java.util.Locale locale)
          Creates a DateTimeFormatterBuilder with any chronology and locale.
DateTimeFormatterBuilder(DateTimeZone zone)
          Creates a DateTimeFormatterBuilder with ISOChronology, in the given time zone, with the default locale.
DateTimeFormatterBuilder(DateTimeZone zone, java.util.Locale locale)
          Creates a DateTimeFormatterBuilder with ISOChronology, in the given time zone, with any locale.
 
Method Summary
 DateTimeFormatterBuilder append(DateTimeFormatter formatter)
          Appends another formatter.
 DateTimeFormatterBuilder append(DateTimeParser parser)
          Appends just a parser.
 DateTimeFormatterBuilder append(DateTimePrinter printer)
          Appends just a printer.
 DateTimeFormatterBuilder append(DateTimePrinter printer, DateTimeParser parser)
          Appends a printer/parser pair.
 DateTimeFormatterBuilder append(DateTimePrinter printer, DateTimeParser[] parsers)
          Appends a printer and a set of matching parsers.
 DateTimeFormatterBuilder appendCenturyOfEra(int minDigits, int maxDigits)
          Instructs the printer to emit a numeric century of era field.
 DateTimeFormatterBuilder appendClockhourOfDay(int minDigits)
          Instructs the printer to emit a numeric clockhourOfDay field.
 DateTimeFormatterBuilder appendClockhourOfHalfday(int minDigits)
          Instructs the printer to emit a numeric clockhourOfHalfday field.
 DateTimeFormatterBuilder appendDayOfMonth(int minDigits)
          Instructs the printer to emit a numeric dayOfMonth field.
 DateTimeFormatterBuilder appendDayOfWeek(int minDigits)
          Instructs the printer to emit a numeric dayOfWeek field.
 DateTimeFormatterBuilder appendDayOfWeekShortText()
          Instructs the printer to emit a short locale-specific dayOfWeek text.
 DateTimeFormatterBuilder appendDayOfWeekText()
          Instructs the printer to emit a locale-specific dayOfWeek text.
 DateTimeFormatterBuilder appendDayOfYear(int minDigits)
          Instructs the printer to emit a numeric dayOfYear field.
 DateTimeFormatterBuilder appendEraText()
          Instructs the printer to emit a locale-specific era text (BC/AD), and the parser to expect it.
 DateTimeFormatterBuilder appendFraction(int minDigits, int maxDigits, int rangeInMillis)
          Instructs the printer to emit a remainder of time as a decimal fraction, sans decimal point.
 DateTimeFormatterBuilder appendFractionOfDay(int minDigits, int maxDigits)
           
 DateTimeFormatterBuilder appendFractionOfHour(int minDigits, int maxDigits)
           
 DateTimeFormatterBuilder appendFractionOfMinute(int minDigits, int maxDigits)
           
 DateTimeFormatterBuilder appendFractionOfSecond(int minDigits, int maxDigits)
           
 DateTimeFormatterBuilder appendHalfdayOfDayText()
          Instructs the printer to emit a locale-specific AM/PM text, and the parser to expect it.
 DateTimeFormatterBuilder appendHourOfDay(int minDigits)
          Instructs the printer to emit a numeric hourOfDay field.
 DateTimeFormatterBuilder appendHourOfHalfday(int minDigits)
          Instructs the printer to emit a numeric hourOfHalfday field.
 DateTimeFormatterBuilder appendLiteral(char c)
          Instructs the printer to emit a specific character, and the parser to expect it.
 DateTimeFormatterBuilder appendLiteral(java.lang.String text)
          Instructs the printer to emit specific text, and the parser to expect it.
 DateTimeFormatterBuilder appendMillisOfDay(int minDigits)
          Instructs the printer to emit a numeric millisOfDay field.
 DateTimeFormatterBuilder appendMillisOfSecond(int minDigits)
          Instructs the printer to emit a numeric millisOfSecond field.
 DateTimeFormatterBuilder appendMinuteOfDay(int minDigits)
          Instructs the printer to emit a numeric minuteOfDay field.
 DateTimeFormatterBuilder appendMinuteOfHour(int minDigits)
          Instructs the printer to emit a numeric minuteOfHour field.
 DateTimeFormatterBuilder appendMonthOfYear(int minDigits)
          Instructs the printer to emit a numeric monthOfYear field.
 DateTimeFormatterBuilder appendMonthOfYearShortText()
          Instructs the printer to emit a locale-specific monthOfYear text.
 DateTimeFormatterBuilder appendMonthOfYearText()
          Instructs the printer to emit a short locale-specific monthOfYear text.
 DateTimeFormatterBuilder appendNumeric(DateTimeField field, int minDigits, int maxDigits)
          Instructs the printer to emit a field value as a decimal number, and the parser to expect an unsigned decimal number.
 DateTimeFormatterBuilder appendOptional(DateTimeParser parser)
          Appends just a parser element which is optional.
 DateTimeFormatterBuilder appendPattern(java.lang.String pattern)
          The pattern syntax is compatible with java.text.SimpleDateFormat, but a few more symbols are also supported.
 DateTimeFormatterBuilder appendSecondOfDay(int minDigits)
          Instructs the printer to emit a numeric secondOfDay field.
 DateTimeFormatterBuilder appendSecondOfMinute(int minDigits)
          Instructs the printer to emit a numeric secondOfMinute field.
 DateTimeFormatterBuilder appendShortText(DateTimeField field)
          Instructs the printer to emit a field value as short text, and the parser to expect text.
 DateTimeFormatterBuilder appendSignedNumeric(DateTimeField field, int minDigits, int maxDigits)
          Instructs the printer to emit a field value as a decimal number, and the parser to expect a signed decimal number.
 DateTimeFormatterBuilder appendText(DateTimeField field)
          Instructs the printer to emit a field value as text, and the parser to expect text.
 DateTimeFormatterBuilder appendTimeZoneName()
          Instructs the printer to emit a locale-specific time zone name.
 DateTimeFormatterBuilder appendTimeZoneOffset(java.lang.String zeroOffsetText, boolean showSeparators, int minFields, int maxFields)
          Instructs the printer to emit text and numbers to display time zone offset from UTC.
 DateTimeFormatterBuilder appendTimeZoneShortName()
          Instructs the printer to emit a short locale-specific time zone name.
 DateTimeFormatterBuilder appendWeekOfWeekyear(int minDigits)
          Instructs the printer to emit a numeric weekOfWeekyear field.
 DateTimeFormatterBuilder appendWeekyear(int minDigits, int maxDigits)
          Instructs the printer to emit a numeric weekyear field.
 DateTimeFormatterBuilder appendYear(int minDigits, int maxDigits)
          Instructs the printer to emit a numeric year field.
 DateTimeFormatterBuilder appendYearOfCentury(int minDigits, int maxDigits)
          Instructs the printer to emit a numeric year of century field.
 DateTimeFormatterBuilder appendYearOfEra(int minDigits, int maxDigits)
          Instructs the printer to emit a numeric yearOfEra field.
 boolean canBuildFormatter()
          Returns true if toFormatter can be called without throwing an UnsupportedOperationException.
 boolean canBuildParser()
          Returns true if toParser can be called without throwing an UnsupportedOperationException.
 boolean canBuildPrinter()
          Returns true if toPrinter can be called without throwing an UnsupportedOperationException.
 void clear()
          Clears out all the appended elements, allowing this builder to be reused.
 Chronology getChronology()
          Returns the chronology being used by the formatter builder.
 java.util.Locale getLocale()
          Returns the locale being used the formatter builder.
 DateTimeFormatter toFormatter()
          Converts to a DateTimeFormatter that prints and parses using all the appended elements.
 DateTimeParser toParser()
          Converts to a DateTimeParser that parses using all the appended elements.
 DateTimePrinter toPrinter()
          Converts to a DateTimePrinter that prints using all the appended elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateTimeFormatterBuilder

public DateTimeFormatterBuilder()
Creates a DateTimeFormatterBuilder with ISOChronology, in the default time zone and locale.


DateTimeFormatterBuilder

public DateTimeFormatterBuilder(DateTimeZone zone)
Creates a DateTimeFormatterBuilder with ISOChronology, in the given time zone, with the default locale.


DateTimeFormatterBuilder

public DateTimeFormatterBuilder(DateTimeZone zone,
                                java.util.Locale locale)
Creates a DateTimeFormatterBuilder with ISOChronology, in the given time zone, with any locale.


DateTimeFormatterBuilder

public DateTimeFormatterBuilder(Chronology chrono)
Creates a DateTimeFormatterBuilder with any chronology and the default locale.

Parameters:
chrono - Chronology to use

DateTimeFormatterBuilder

public DateTimeFormatterBuilder(Chronology chrono,
                                java.util.Locale locale)
Creates a DateTimeFormatterBuilder with any chronology and locale.

Parameters:
chrono - Chronology to use
locale - Locale to use
Method Detail

getChronology

public Chronology getChronology()
Returns the chronology being used by the formatter builder.


getLocale

public java.util.Locale getLocale()
Returns the locale being used the formatter builder.


toPrinter

public DateTimePrinter toPrinter()
                          throws java.lang.UnsupportedOperationException
Converts to a DateTimePrinter that prints using all the appended elements. Subsequent changes to this builder do not affect the returned printer.

Throws:
java.lang.UnsupportedOperationException - if any formatter element doesn't support printing

toParser

public DateTimeParser toParser()
                        throws java.lang.UnsupportedOperationException
Converts to a DateTimeParser that parses using all the appended elements. Subsequent changes to this builder do not affect the returned parser.

Throws:
java.lang.UnsupportedOperationException - if any formatter element doesn't support parsing

toFormatter

public DateTimeFormatter toFormatter()
                              throws java.lang.UnsupportedOperationException
Converts to a DateTimeFormatter that prints and parses using all the appended elements. Subsequent changes to this builder do not affect the returned formatter.

Throws:
java.lang.UnsupportedOperationException - if any formatter element doesn't support both printing and parsing

canBuildPrinter

public boolean canBuildPrinter()
Returns true if toPrinter can be called without throwing an UnsupportedOperationException.


canBuildParser

public boolean canBuildParser()
Returns true if toParser can be called without throwing an UnsupportedOperationException.


canBuildFormatter

public boolean canBuildFormatter()
Returns true if toFormatter can be called without throwing an UnsupportedOperationException.


clear

public void clear()
Clears out all the appended elements, allowing this builder to be reused.


append

public DateTimeFormatterBuilder append(DateTimeFormatter formatter)
                                throws java.lang.IllegalArgumentException
Appends another formatter.

Throws:
java.lang.IllegalArgumentException - if formatter is null

append

public DateTimeFormatterBuilder append(DateTimePrinter printer)
                                throws java.lang.IllegalArgumentException
Appends just a printer. With no matching parser, a parser cannot be built from this DateTimeFormatterBuilder.

Throws:
java.lang.IllegalArgumentException - if printer is null

append

public DateTimeFormatterBuilder append(DateTimeParser parser)
Appends just a parser. With no matching printer, a printer cannot be built from this builder.

Throws:
java.lang.IllegalArgumentException - if parser is null

append

public DateTimeFormatterBuilder append(DateTimePrinter printer,
                                       DateTimeParser parser)
                                throws java.lang.IllegalArgumentException
Appends a printer/parser pair.

Throws:
java.lang.IllegalArgumentException - if printer or parser is null

append

public DateTimeFormatterBuilder append(DateTimePrinter printer,
                                       DateTimeParser[] parsers)
                                throws java.lang.IllegalArgumentException
Appends a printer and a set of matching parsers. When parsing, the first parser in the list is selected for parsing. If it fails, the next is chosen, and so on. If none of these parsers succeeds, then the failed position of the parser that made the greatest progress is returned.

Only the printer is optional. In addtion, it is illegal for any but the last of the parser array elements to be null. If the last element is null, this represents the empty parser. The presence of an empty parser indicates that the entire array of parse formats is optional.

Throws:
java.lang.IllegalArgumentException - if any parser element but the last is null

appendOptional

public DateTimeFormatterBuilder appendOptional(DateTimeParser parser)
Appends just a parser element which is optional. With no matching printer, a printer cannot be built from this DateTimeFormatterBuilder.

Throws:
java.lang.IllegalArgumentException - if parser is null

appendLiteral

public DateTimeFormatterBuilder appendLiteral(char c)
Instructs the printer to emit a specific character, and the parser to expect it. The parser is case-insensitive.


appendLiteral

public DateTimeFormatterBuilder appendLiteral(java.lang.String text)
Instructs the printer to emit specific text, and the parser to expect it. The parser is case-insensitive.


appendNumeric

public DateTimeFormatterBuilder appendNumeric(DateTimeField field,
                                              int minDigits,
                                              int maxDigits)
Instructs the printer to emit a field value as a decimal number, and the parser to expect an unsigned decimal number.

Parameters:
field - field should operate in UTC or be time zone agnostic
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendSignedNumeric

public DateTimeFormatterBuilder appendSignedNumeric(DateTimeField field,
                                                    int minDigits,
                                                    int maxDigits)
Instructs the printer to emit a field value as a decimal number, and the parser to expect a signed decimal number.

Parameters:
field - field should operate in UTC or be time zone agnostic
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendText

public DateTimeFormatterBuilder appendText(DateTimeField field)
Instructs the printer to emit a field value as text, and the parser to expect text.

Parameters:
field - field should operate in UTC or be time zone agnostic

appendShortText

public DateTimeFormatterBuilder appendShortText(DateTimeField field)
Instructs the printer to emit a field value as short text, and the parser to expect text.

Parameters:
field - field should operate in UTC or be time zone agnostic

appendFraction

public DateTimeFormatterBuilder appendFraction(int minDigits,
                                               int maxDigits,
                                               int rangeInMillis)
Instructs the printer to emit a remainder of time as a decimal fraction, sans decimal point. For example, if the range is specified as 60000 (milliseconds in one minute) and the time is 12:30:45, the value printed is 75. A decimal point is implied, so the fraction is 0.75, or three-quarters of a minute.

Parameters:
minDigits - minumum number of digits to print.
maxDigits - maximum number of digits to print or parse.
rangeInMillis - range of values in fraction

appendFractionOfSecond

public DateTimeFormatterBuilder appendFractionOfSecond(int minDigits,
                                                       int maxDigits)
Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to print or parse

appendFractionOfMinute

public DateTimeFormatterBuilder appendFractionOfMinute(int minDigits,
                                                       int maxDigits)
Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to print or parse

appendFractionOfHour

public DateTimeFormatterBuilder appendFractionOfHour(int minDigits,
                                                     int maxDigits)
Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to print or parse

appendFractionOfDay

public DateTimeFormatterBuilder appendFractionOfDay(int minDigits,
                                                    int maxDigits)
Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to print or parse

appendMillisOfSecond

public DateTimeFormatterBuilder appendMillisOfSecond(int minDigits)
Instructs the printer to emit a numeric millisOfSecond field.

Parameters:
minDigits - minumum number of digits to print

appendMillisOfDay

public DateTimeFormatterBuilder appendMillisOfDay(int minDigits)
Instructs the printer to emit a numeric millisOfDay field.

Parameters:
minDigits - minumum number of digits to print

appendSecondOfMinute

public DateTimeFormatterBuilder appendSecondOfMinute(int minDigits)
Instructs the printer to emit a numeric secondOfMinute field.

Parameters:
minDigits - minumum number of digits to print

appendSecondOfDay

public DateTimeFormatterBuilder appendSecondOfDay(int minDigits)
Instructs the printer to emit a numeric secondOfDay field.

Parameters:
minDigits - minumum number of digits to print

appendMinuteOfHour

public DateTimeFormatterBuilder appendMinuteOfHour(int minDigits)
Instructs the printer to emit a numeric minuteOfHour field.

Parameters:
minDigits - minumum number of digits to print

appendMinuteOfDay

public DateTimeFormatterBuilder appendMinuteOfDay(int minDigits)
Instructs the printer to emit a numeric minuteOfDay field.

Parameters:
minDigits - minumum number of digits to print

appendHourOfDay

public DateTimeFormatterBuilder appendHourOfDay(int minDigits)
Instructs the printer to emit a numeric hourOfDay field.

Parameters:
minDigits - minumum number of digits to print

appendClockhourOfDay

public DateTimeFormatterBuilder appendClockhourOfDay(int minDigits)
Instructs the printer to emit a numeric clockhourOfDay field.

Parameters:
minDigits - minumum number of digits to print

appendHourOfHalfday

public DateTimeFormatterBuilder appendHourOfHalfday(int minDigits)
Instructs the printer to emit a numeric hourOfHalfday field.

Parameters:
minDigits - minumum number of digits to print

appendClockhourOfHalfday

public DateTimeFormatterBuilder appendClockhourOfHalfday(int minDigits)
Instructs the printer to emit a numeric clockhourOfHalfday field.

Parameters:
minDigits - minumum number of digits to print

appendDayOfWeek

public DateTimeFormatterBuilder appendDayOfWeek(int minDigits)
Instructs the printer to emit a numeric dayOfWeek field.

Parameters:
minDigits - minumum number of digits to print

appendDayOfMonth

public DateTimeFormatterBuilder appendDayOfMonth(int minDigits)
Instructs the printer to emit a numeric dayOfMonth field.

Parameters:
minDigits - minumum number of digits to print

appendDayOfYear

public DateTimeFormatterBuilder appendDayOfYear(int minDigits)
Instructs the printer to emit a numeric dayOfYear field.

Parameters:
minDigits - minumum number of digits to print

appendWeekOfWeekyear

public DateTimeFormatterBuilder appendWeekOfWeekyear(int minDigits)
Instructs the printer to emit a numeric weekOfWeekyear field.

Parameters:
minDigits - minumum number of digits to print

appendWeekyear

public DateTimeFormatterBuilder appendWeekyear(int minDigits,
                                               int maxDigits)
Instructs the printer to emit a numeric weekyear field.

Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendMonthOfYear

public DateTimeFormatterBuilder appendMonthOfYear(int minDigits)
Instructs the printer to emit a numeric monthOfYear field.

Parameters:
minDigits - minumum number of digits to print

appendYear

public DateTimeFormatterBuilder appendYear(int minDigits,
                                           int maxDigits)
Instructs the printer to emit a numeric year field.

Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendYearOfEra

public DateTimeFormatterBuilder appendYearOfEra(int minDigits,
                                                int maxDigits)
Instructs the printer to emit a numeric yearOfEra field.

Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendYearOfCentury

public DateTimeFormatterBuilder appendYearOfCentury(int minDigits,
                                                    int maxDigits)
Instructs the printer to emit a numeric year of century field.

Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendCenturyOfEra

public DateTimeFormatterBuilder appendCenturyOfEra(int minDigits,
                                                   int maxDigits)
Instructs the printer to emit a numeric century of era field.

Parameters:
minDigits - minumum number of digits to print
maxDigits - maximum number of digits to parse, or the estimated maximum number of digits to print

appendHalfdayOfDayText

public DateTimeFormatterBuilder appendHalfdayOfDayText()
Instructs the printer to emit a locale-specific AM/PM text, and the parser to expect it. The parser is case-insensitive.


appendDayOfWeekText

public DateTimeFormatterBuilder appendDayOfWeekText()
Instructs the printer to emit a locale-specific dayOfWeek text. The parser will accept a long or short dayOfWeek text, case-insensitive.


appendDayOfWeekShortText

public DateTimeFormatterBuilder appendDayOfWeekShortText()
Instructs the printer to emit a short locale-specific dayOfWeek text. The parser will accept a long or short dayOfWeek text, case-insensitive.


appendMonthOfYearText

public DateTimeFormatterBuilder appendMonthOfYearText()
Instructs the printer to emit a short locale-specific monthOfYear text. The parser will accept a long or short monthOfYear text, case-insensitive.


appendMonthOfYearShortText

public DateTimeFormatterBuilder appendMonthOfYearShortText()
Instructs the printer to emit a locale-specific monthOfYear text. The parser will accept a long or short monthOfYear text, case-insensitive.


appendEraText

public DateTimeFormatterBuilder appendEraText()
Instructs the printer to emit a locale-specific era text (BC/AD), and the parser to expect it. The parser is case-insensitive.


appendTimeZoneName

public DateTimeFormatterBuilder appendTimeZoneName()
Instructs the printer to emit a locale-specific time zone name. A parser cannot be created from this builder if a time zone name is appended.


appendTimeZoneShortName

public DateTimeFormatterBuilder appendTimeZoneShortName()
Instructs the printer to emit a short locale-specific time zone name. A parser cannot be created from this builder if time zone name is appended.


appendTimeZoneOffset

public DateTimeFormatterBuilder appendTimeZoneOffset(java.lang.String zeroOffsetText,
                                                     boolean showSeparators,
                                                     int minFields,
                                                     int maxFields)
Instructs the printer to emit text and numbers to display time zone offset from UTC. A parser will use the parsed time zone offset to adjust the datetime.

Parameters:
zeroOffsetText - Text to use if time zone offset is zero. If null, offset is always shown.
showSeparators - If true, prints ':' separator before minute and second field and prints '.' separator before fraction field.
minFields - minimum number of fields to print, stopping when no more precision is required. 1=hours, 2=minutes, 3=seconds, 4=fraction
maxFields - maximum number of fields to print

appendPattern

public DateTimeFormatterBuilder appendPattern(java.lang.String pattern)
                                       throws java.lang.IllegalArgumentException
The pattern syntax is compatible with java.text.SimpleDateFormat, but a few more symbols are also supported.

To specify the time format use a time pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:

 Symbol  Meaning                      Presentation  Examples
 ------  -------                      ------------  -------
 G       era                          text          AD
 C       century of era (>=0)         number        20
 Y       year of era (>=0)            year          1996

 x       weekyear                     year          1996
 w       week of weekyear             number        27
 e       day of week                  number        2
 E       day of week                  text          Tuesday; Tue

 y       year                         year          1996
 D       day of year                  number        189
 M       month of year                month         July; Jul; 07
 d       day of month                 number        10

 a       halfday of day               text          PM
 K       hour of halfday (0~11)       number        0
 h       clockhour of halfday (1~12)  number        12

 H       hour of day (0~23)           number        0
 k       clockhour of day (1~24)      number        24
 m       minute of hour               number        30
 s       second of minute             number        55
 S       fraction of second           number        978

 z       time zone                    text          Pacific Standard Time; PST
 Z       RFC 822 time zone            text          -0800; -08:00

 '       escape for text              delimiter
 ''      single quote                 literal       '
 
The count of pattern letters determine the format.

Text: If the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available.

Number: The minimum number of digits. Shorter numbers are zero-padded to this amount.

Year: Numeric presentation for year and weekyear fields are handled specially. For example, if the count of 'y' is 2, the year will be displayed as the zero-based year of the century, which is two digits.

Month: 3 or over, use text, otherwise use number.

Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.

java.lang.IllegalArgumentException

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.