Class StrictISODateTimeFormat
Date-time formatting is performed by the DateTimeFormatter
class.
Three classes provide factory methods to create formatters, and this is one.
The others are DateTimeFormat
and DateTimeFormatterBuilder
.
ISO8601 is the international standard for data interchange. It defines a
framework, rather than an absolute standard. As a result this provider has a
number of methods that represent common uses of the framework. The most common
formats are date
, time
, and dateTime
.
For example, to format a date time in ISO format:
DateTime dt = new DateTime(); DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); String str = fmt.print(dt);
Note that these formatters mostly follow the ISO8601 standard for printing. For parsing, the formatters are more lenient and allow formats that are not in strict compliance with the standard.
It is important to understand that these formatters are not linked to
the ISOChronology
. These formatters may be used with any
chronology, however there may be certain side effects with more unusual
chronologies. For example, the ISO formatters rely on dayOfWeek being
single digit, dayOfMonth being two digit and dayOfYear being three digit.
A chronology with a ten day week would thus cause issues. However, in
general, it is safe to use these formatters with other chronologies.
ISODateTimeFormat is thread-safe and immutable, and the formatters it returns are as well.
- Since:
- 1.0
- See Also:
DateTimeFormat
,DateTimeFormatterBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.joda.time.format.DateTimeFormatter
Returns a basic formatter for a full date as four digit year, two digit month of year, and two digit day of month (yyyyMMdd).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter that combines a basic date and time, separated by a 'T' (yyyyMMdd'T'HHmmss.SSSZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter that combines a basic date and time without millis, separated by a 'T' (yyyyMMdd'T'HHmmssZ).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a full ordinal date, using a four digit year and three digit dayOfYear (yyyyDDD).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear (yyyyDDD'T'HHmmss.SSSZ).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear (yyyyDDD'T'HHmmssZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone offset (HHmmss.SSSZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset (HHmmssZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone offset prefixed by 'T' ('T'HHmmss.SSSZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by 'T' ('T'HHmmssZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week (xxxx'W'wwe).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter that combines a basic weekyear date and time, separated by a 'T' (xxxx'W'wwe'T'HHmmss.SSSZ).static org.joda.time.format.DateTimeFormatter
Returns a basic formatter that combines a basic weekyear date and time without millis, separated by a 'T' (xxxx'W'wwe'T'HHmmssZ).static org.joda.time.format.DateTimeFormatter
date()
Returns a formatter for a full date as four digit year, two digit month of year, and two digit day of month (yyyy-MM-dd).static org.joda.time.format.DateTimeFormatter
Returns a generic ISO date parser for parsing dates.static org.joda.time.format.DateTimeFormatter
dateHour()
Returns a formatter that combines a full date and two digit hour of day.static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full date, two digit hour of day, and two digit minute of hour.static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full date, two digit hour of day, two digit minute of hour, and two digit second of minute.static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (yyyy-MM-dd'T'HH:mm:ss.SSS).static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (yyyy-MM-dd'T'HH:mm:ss.SSS).static org.joda.time.format.DateTimeFormatter
Returns a generic ISO datetime parser where the date is mandatory and the time is optional.static org.joda.time.format.DateTimeFormatter
Returns a generic ISO date parser for parsing dates with a possible zone.static org.joda.time.format.DateTimeFormatter
dateTime()
Returns a formatter that combines a full date and time, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ss.SSSZZ).static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full date and time without millis, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ssZZ).static org.joda.time.format.DateTimeFormatter
Returns a generic ISO datetime parser which parses either a date or a time or both.static org.joda.time.format.DateTimeFormatter
forFields(Collection<org.joda.time.DateTimeFieldType> fields, boolean extended, boolean strictISO)
Returns a formatter that outputs only those fields specified.static org.joda.time.format.DateTimeFormatter
hour()
Returns a formatter for a two digit hour of day.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a two digit hour of day and two digit minute of hour.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a two digit hour of day, two digit minute of hour, and two digit second of minute.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (HH:mm:ss.SSS).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (HH:mm:ss.SSS).static org.joda.time.format.DateTimeFormatter
Returns a generic ISO datetime parser where the date is mandatory and the time is optional.static org.joda.time.format.DateTimeFormatter
Returns a generic ISO date parser for parsing local dates.static org.joda.time.format.DateTimeFormatter
Returns a generic ISO time parser for parsing local times.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a full ordinal date, using a four digit year and three digit dayOfYear (yyyy-DDD).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear (yyyy-DDD'T'HH:mm:ss.SSSZZ).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear (yyyy-DDD'T'HH:mm:ssZZ).static org.joda.time.format.DateTimeFormatter
time()
Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset (HH:mm:ss.SSSZZ).static org.joda.time.format.DateTimeFormatter
Returns a generic ISO time parser.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset (HH:mm:ssZZ).static org.joda.time.format.DateTimeFormatter
Returns a generic ISO time parser for parsing times with a possible zone.static org.joda.time.format.DateTimeFormatter
tTime()
Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset prefixed by 'T' ('T'HH:mm:ss.SSSZZ).static org.joda.time.format.DateTimeFormatter
Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by 'T' ('T'HH:mm:ssZZ).static org.joda.time.format.DateTimeFormatter
weekDate()
Returns a formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week (xxxx-'W'ww-e).static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full weekyear date and time, separated by a 'T' (xxxx-'W'ww-e'T'HH:mm:ss.SSSZZ).static org.joda.time.format.DateTimeFormatter
Returns a formatter that combines a full weekyear date and time without millis, separated by a 'T' (xxxx-'W'ww-e'T'HH:mm:ssZZ).static org.joda.time.format.DateTimeFormatter
weekyear()
Returns a formatter for a four digit weekyear.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a four digit weekyear and two digit week of weekyear.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a four digit weekyear, two digit week of weekyear, and one digit day of week.static org.joda.time.format.DateTimeFormatter
year()
Returns a formatter for a four digit year.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a four digit year and two digit month of year.static org.joda.time.format.DateTimeFormatter
Returns a formatter for a four digit year, two digit month of year, and two digit day of month.
-
Constructor Details
-
StrictISODateTimeFormat
protected StrictISODateTimeFormat()Constructor.- Since:
- 1.1 (previously private)
-
-
Method Details
-
forFields
public static org.joda.time.format.DateTimeFormatter forFields(Collection<org.joda.time.DateTimeFieldType> fields, boolean extended, boolean strictISO)Returns a formatter that outputs only those fields specified.This method examines the fields provided and returns an ISO-style formatter that best fits. This can be useful for outputting less-common ISO styles, such as YearMonth (YYYY-MM) or MonthDay (--MM-DD).
The list provided may have overlapping fields, such as dayOfWeek and dayOfMonth. In this case, the style is chosen based on the following list, thus in the example, the calendar style is chosen as dayOfMonth is higher in priority than dayOfWeek:
- monthOfYear - calendar date style
- dayOfYear - ordinal date style
- weekOfWeekYear - week date style
- dayOfMonth - calendar date style
- dayOfWeek - week date style
- year
- weekyear
Extended Basic Fields 2005-03-25 20050325 year/monthOfYear/dayOfMonth 2005-03 2005-03 year/monthOfYear 2005--25 2005--25 year/dayOfMonth * 2005 2005 year --03-25 --0325 monthOfYear/dayOfMonth --03 --03 monthOfYear ---03 ---03 dayOfMonth 2005-084 2005084 year/dayOfYear -084 -084 dayOfYear 2005-W12-5 2005W125 weekyear/weekOfWeekyear/dayOfWeek 2005-W-5 2005W-5 weekyear/dayOfWeek * 2005-W12 2005W12 weekyear/weekOfWeekyear -W12-5 -W125 weekOfWeekyear/dayOfWeek -W12 -W12 weekOfWeekyear -W-5 -W-5 dayOfWeek 10:20:30.040 102030.040 hour/minute/second/milli 10:20:30 102030 hour/minute/second 10:20 1020 hour/minute 10 10 hour -20:30.040 -2030.040 minute/second/milli -20:30 -2030 minute/second -20 -20 minute --30.040 --30.040 second/milli --30 --30 second ---.040 ---.040 milli * 10-30.040 10-30.040 hour/second/milli * 10:20-.040 1020-.040 hour/minute/milli * 10-30 10-30 hour/second * 10--.040 10--.040 hour/milli * -20-.040 -20-.040 minute/milli * plus datetime formats like {date}T{time}
* indicates that this is not an official ISO format and can be excluded by passing instrictISO
astrue
.This method can side effect the input collection of fields. If the input collection is modifiable, then each field that was added to the formatter will be removed from the collection, including any duplicates. If the input collection is unmodifiable then no side effect occurs.
This side effect processing is useful if you need to know whether all the fields were converted into the formatter or not. To achieve this, pass in a modifiable list, and check that it is empty on exit.
- Parameters:
fields
- the fields to get a formatter for, not null, updated by the method call unless unmodifiable, removing those fields built in the formatterextended
- true to use the extended format (with separators)strictISO
- true to stick exactly to ISO8601, false to include additional formats- Returns:
- a suitable formatter
- Throws:
IllegalArgumentException
- if there is no format for the fields- Since:
- 1.1
-
dateParser
public static org.joda.time.format.DateTimeFormatter dateParser()Returns a generic ISO date parser for parsing dates with a possible zone.The returned formatter can only be used for parsing, printing is unsupported.
It accepts formats described by the following syntax:
date = date-element ['T' offset] date-element = std-date-element | ord-date-element | week-date-element std-date-element = yyyy ['-' MM ['-' dd]] ord-date-element = yyyy ['-' DDD] week-date-element = xxxx '-W' ww ['-' e] offset = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])
-
localDateParser
public static org.joda.time.format.DateTimeFormatter localDateParser()Returns a generic ISO date parser for parsing local dates.The returned formatter can only be used for parsing, printing is unsupported.
This parser is initialised with the local (UTC) time zone.
It accepts formats described by the following syntax:
date-element = std-date-element | ord-date-element | week-date-element std-date-element = yyyy ['-' MM ['-' dd]] ord-date-element = yyyy ['-' DDD] week-date-element = xxxx '-W' ww ['-' e]
- Since:
- 1.3
-
dateElementParser
public static org.joda.time.format.DateTimeFormatter dateElementParser()Returns a generic ISO date parser for parsing dates.The returned formatter can only be used for parsing, printing is unsupported.
It accepts formats described by the following syntax:
date-element = std-date-element | ord-date-element | week-date-element std-date-element = yyyy ['-' MM ['-' dd]] ord-date-element = yyyy ['-' DDD] week-date-element = xxxx '-W' ww ['-' e]
-
timeParser
public static org.joda.time.format.DateTimeFormatter timeParser()Returns a generic ISO time parser for parsing times with a possible zone.The returned formatter can only be used for parsing, printing is unsupported.
The parser is strict by default, thus time string
24:00
cannot be parsed.It accepts formats described by the following syntax:
time = ['T'] time-element [offset] time-element = HH [minute-element] | [fraction] minute-element = ':' mm [second-element] | [fraction] second-element = ':' ss [fraction] fraction = ('.' | ',') digit+ offset = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])
-
localTimeParser
public static org.joda.time.format.DateTimeFormatter localTimeParser()Returns a generic ISO time parser for parsing local times.The returned formatter can only be used for parsing, printing is unsupported.
This parser is initialised with the local (UTC) time zone. The parser is strict by default, thus time string
24:00
cannot be parsed.It accepts formats described by the following syntax:
time = ['T'] time-element time-element = HH [minute-element] | [fraction] minute-element = ':' mm [second-element] | [fraction] second-element = ':' ss [fraction] fraction = ('.' | ',') digit+
- Since:
- 1.3
-
timeElementParser
public static org.joda.time.format.DateTimeFormatter timeElementParser()Returns a generic ISO time parser.The returned formatter can only be used for parsing, printing is unsupported.
The parser is strict by default, thus time string
24:00
cannot be parsed.It accepts formats described by the following syntax:
time-element = HH [minute-element] | [fraction] minute-element = ':' mm [second-element] | [fraction] second-element = ':' ss [fraction] fraction = ('.' | ',') digit+
-
dateTimeParser
public static org.joda.time.format.DateTimeFormatter dateTimeParser()Returns a generic ISO datetime parser which parses either a date or a time or both.The returned formatter can only be used for parsing, printing is unsupported.
The parser is strict by default, thus time string
24:00
cannot be parsed.It accepts formats described by the following syntax:
datetime = time | date-opt-time time = 'T' time-element [offset] date-opt-time = date-element ['T' [time-element] [offset]] date-element = std-date-element | ord-date-element | week-date-element std-date-element = yyyy ['-' MM ['-' dd]] ord-date-element = yyyy ['-' DDD] week-date-element = xxxx '-W' ww ['-' e] time-element = HH [minute-element] | [fraction] minute-element = ':' mm [second-element] | [fraction] second-element = ':' ss [fraction] fraction = ('.' | ',') digit+ offset = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])
-
dateOptionalTimeParser
public static org.joda.time.format.DateTimeFormatter dateOptionalTimeParser()Returns a generic ISO datetime parser where the date is mandatory and the time is optional.The returned formatter can only be used for parsing, printing is unsupported.
This parser can parse zoned datetimes. The parser is strict by default, thus time string
24:00
cannot be parsed.It accepts formats described by the following syntax:
date-opt-time = date-element ['T' [time-element] [offset]] date-element = std-date-element | ord-date-element | week-date-element std-date-element = yyyy ['-' MM ['-' dd]] ord-date-element = yyyy ['-' DDD] week-date-element = xxxx '-W' ww ['-' e] time-element = HH [minute-element] | [fraction] minute-element = ':' mm [second-element] | [fraction] second-element = ':' ss [fraction] fraction = ('.' | ',') digit+
- Since:
- 1.3
-
localDateOptionalTimeParser
public static org.joda.time.format.DateTimeFormatter localDateOptionalTimeParser()Returns a generic ISO datetime parser where the date is mandatory and the time is optional.The returned formatter can only be used for parsing, printing is unsupported.
This parser only parses local datetimes. This parser is initialised with the local (UTC) time zone. The parser is strict by default, thus time string
24:00
cannot be parsed.It accepts formats described by the following syntax:
datetime = date-element ['T' time-element] date-element = std-date-element | ord-date-element | week-date-element std-date-element = yyyy ['-' MM ['-' dd]] ord-date-element = yyyy ['-' DDD] week-date-element = xxxx '-W' ww ['-' e] time-element = HH [minute-element] | [fraction] minute-element = ':' mm [second-element] | [fraction] second-element = ':' ss [fraction] fraction = ('.' | ',') digit+
- Since:
- 1.3
-
date
public static org.joda.time.format.DateTimeFormatter date()Returns a formatter for a full date as four digit year, two digit month of year, and two digit day of month (yyyy-MM-dd).The returned formatter prints and parses only this format. See
dateParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for yyyy-MM-dd
-
time
public static org.joda.time.format.DateTimeFormatter time()Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset (HH:mm:ss.SSSZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds. See
timeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for HH:mm:ss.SSSZZ
-
timeNoMillis
public static org.joda.time.format.DateTimeFormatter timeNoMillis()Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset (HH:mm:ssZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds. See
timeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for HH:mm:ssZZ
-
tTime
public static org.joda.time.format.DateTimeFormatter tTime()Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit fraction of second, and time zone offset prefixed by 'T' ('T'HH:mm:ss.SSSZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds. See
timeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for 'T'HH:mm:ss.SSSZZ
-
tTimeNoMillis
public static org.joda.time.format.DateTimeFormatter tTimeNoMillis()Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by 'T' ('T'HH:mm:ssZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds. See
timeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for 'T'HH:mm:ssZZ
-
dateTime
public static org.joda.time.format.DateTimeFormatter dateTime()Returns a formatter that combines a full date and time, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ss.SSSZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds. See
dateTimeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for yyyy-MM-dd'T'HH:mm:ss.SSSZZ
-
dateTimeNoMillis
public static org.joda.time.format.DateTimeFormatter dateTimeNoMillis()Returns a formatter that combines a full date and time without millis, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ssZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds. See
dateTimeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for yyyy-MM-dd'T'HH:mm:ssZZ
-
ordinalDate
public static org.joda.time.format.DateTimeFormatter ordinalDate()Returns a formatter for a full ordinal date, using a four digit year and three digit dayOfYear (yyyy-DDD).The returned formatter prints and parses only this format. See
dateParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for yyyy-DDD
- Since:
- 1.1
-
ordinalDateTime
public static org.joda.time.format.DateTimeFormatter ordinalDateTime()Returns a formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear (yyyy-DDD'T'HH:mm:ss.SSSZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds. See
dateTimeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for yyyy-DDD'T'HH:mm:ss.SSSZZ
- Since:
- 1.1
-
ordinalDateTimeNoMillis
public static org.joda.time.format.DateTimeFormatter ordinalDateTimeNoMillis()Returns a formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear (yyyy-DDD'T'HH:mm:ssZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds. See
dateTimeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for yyyy-DDD'T'HH:mm:ssZZ
- Since:
- 1.1
-
weekDate
public static org.joda.time.format.DateTimeFormatter weekDate()Returns a formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week (xxxx-'W'ww-e).The returned formatter prints and parses only this format. See
dateParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for xxxx-'W'ww-e
-
weekDateTime
public static org.joda.time.format.DateTimeFormatter weekDateTime()Returns a formatter that combines a full weekyear date and time, separated by a 'T' (xxxx-'W'ww-e'T'HH:mm:ss.SSSZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds. See
dateTimeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for xxxx-'W'ww-e'T'HH:mm:ss.SSSZZ
-
weekDateTimeNoMillis
public static org.joda.time.format.DateTimeFormatter weekDateTimeNoMillis()Returns a formatter that combines a full weekyear date and time without millis, separated by a 'T' (xxxx-'W'ww-e'T'HH:mm:ssZZ).The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds. See
dateTimeParser()
for a more flexible parser that accepts different formats.- Returns:
- a formatter for xxxx-'W'ww-e'T'HH:mm:ssZZ
-
basicDate
public static org.joda.time.format.DateTimeFormatter basicDate()Returns a basic formatter for a full date as four digit year, two digit month of year, and two digit day of month (yyyyMMdd).The returned formatter prints and parses only this format.
- Returns:
- a formatter for yyyyMMdd
-
basicTime
public static org.joda.time.format.DateTimeFormatter basicTime()Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone offset (HHmmss.SSSZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds.
- Returns:
- a formatter for HHmmss.SSSZ
-
basicTimeNoMillis
public static org.joda.time.format.DateTimeFormatter basicTimeNoMillis()Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset (HHmmssZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds.
- Returns:
- a formatter for HHmmssZ
-
basicTTime
public static org.joda.time.format.DateTimeFormatter basicTTime()Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, three digit millis, and time zone offset prefixed by 'T' ('T'HHmmss.SSSZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds.
- Returns:
- a formatter for 'T'HHmmss.SSSZ
-
basicTTimeNoMillis
public static org.joda.time.format.DateTimeFormatter basicTTimeNoMillis()Returns a basic formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and time zone offset prefixed by 'T' ('T'HHmmssZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds.
- Returns:
- a formatter for 'T'HHmmssZ
-
basicDateTime
public static org.joda.time.format.DateTimeFormatter basicDateTime()Returns a basic formatter that combines a basic date and time, separated by a 'T' (yyyyMMdd'T'HHmmss.SSSZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds.
- Returns:
- a formatter for yyyyMMdd'T'HHmmss.SSSZ
-
basicDateTimeNoMillis
public static org.joda.time.format.DateTimeFormatter basicDateTimeNoMillis()Returns a basic formatter that combines a basic date and time without millis, separated by a 'T' (yyyyMMdd'T'HHmmssZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds.
- Returns:
- a formatter for yyyyMMdd'T'HHmmssZ
-
basicOrdinalDate
public static org.joda.time.format.DateTimeFormatter basicOrdinalDate()Returns a formatter for a full ordinal date, using a four digit year and three digit dayOfYear (yyyyDDD).The returned formatter prints and parses only this format.
- Returns:
- a formatter for yyyyDDD
- Since:
- 1.1
-
basicOrdinalDateTime
public static org.joda.time.format.DateTimeFormatter basicOrdinalDateTime()Returns a formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear (yyyyDDD'T'HHmmss.SSSZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds.
- Returns:
- a formatter for yyyyDDD'T'HHmmss.SSSZ
- Since:
- 1.1
-
basicOrdinalDateTimeNoMillis
public static org.joda.time.format.DateTimeFormatter basicOrdinalDateTimeNoMillis()Returns a formatter for a full ordinal date and time without millis, using a four digit year and three digit dayOfYear (yyyyDDD'T'HHmmssZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds.
- Returns:
- a formatter for yyyyDDD'T'HHmmssZ
- Since:
- 1.1
-
basicWeekDate
public static org.joda.time.format.DateTimeFormatter basicWeekDate()Returns a basic formatter for a full date as four digit weekyear, two digit week of weekyear, and one digit day of week (xxxx'W'wwe).The returned formatter prints and parses only this format.
- Returns:
- a formatter for xxxx'W'wwe
-
basicWeekDateTime
public static org.joda.time.format.DateTimeFormatter basicWeekDateTime()Returns a basic formatter that combines a basic weekyear date and time, separated by a 'T' (xxxx'W'wwe'T'HHmmss.SSSZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which includes milliseconds.
- Returns:
- a formatter for xxxx'W'wwe'T'HHmmss.SSSZ
-
basicWeekDateTimeNoMillis
public static org.joda.time.format.DateTimeFormatter basicWeekDateTimeNoMillis()Returns a basic formatter that combines a basic weekyear date and time without millis, separated by a 'T' (xxxx'W'wwe'T'HHmmssZ).The time zone offset is 'Z' for zero, and of the form '±HHmm' for non-zero. The parser is strict by default, thus time string
24:00
cannot be parsed.The returned formatter prints and parses only this format, which excludes milliseconds.
- Returns:
- a formatter for xxxx'W'wwe'T'HHmmssZ
-
year
public static org.joda.time.format.DateTimeFormatter year()Returns a formatter for a four digit year. (yyyy)- Returns:
- a formatter for yyyy
-
yearMonth
public static org.joda.time.format.DateTimeFormatter yearMonth()Returns a formatter for a four digit year and two digit month of year. (yyyy-MM)- Returns:
- a formatter for yyyy-MM
-
yearMonthDay
public static org.joda.time.format.DateTimeFormatter yearMonthDay()Returns a formatter for a four digit year, two digit month of year, and two digit day of month. (yyyy-MM-dd)- Returns:
- a formatter for yyyy-MM-dd
-
weekyear
public static org.joda.time.format.DateTimeFormatter weekyear()Returns a formatter for a four digit weekyear. (xxxx)- Returns:
- a formatter for xxxx
-
weekyearWeek
public static org.joda.time.format.DateTimeFormatter weekyearWeek()Returns a formatter for a four digit weekyear and two digit week of weekyear. (xxxx-'W'ww)- Returns:
- a formatter for xxxx-'W'ww
-
weekyearWeekDay
public static org.joda.time.format.DateTimeFormatter weekyearWeekDay()Returns a formatter for a four digit weekyear, two digit week of weekyear, and one digit day of week. (xxxx-'W'ww-e)- Returns:
- a formatter for xxxx-'W'ww-e
-
hour
public static org.joda.time.format.DateTimeFormatter hour()Returns a formatter for a two digit hour of day. (HH)- Returns:
- a formatter for HH
-
hourMinute
public static org.joda.time.format.DateTimeFormatter hourMinute()Returns a formatter for a two digit hour of day and two digit minute of hour. (HH:mm)- Returns:
- a formatter for HH:mm
-
hourMinuteSecond
public static org.joda.time.format.DateTimeFormatter hourMinuteSecond()Returns a formatter for a two digit hour of day, two digit minute of hour, and two digit second of minute. (HH:mm:ss)- Returns:
- a formatter for HH:mm:ss
-
hourMinuteSecondMillis
public static org.joda.time.format.DateTimeFormatter hourMinuteSecondMillis()Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (HH:mm:ss.SSS). Parsing will parse up to 3 fractional second digits.- Returns:
- a formatter for HH:mm:ss.SSS
-
hourMinuteSecondFraction
public static org.joda.time.format.DateTimeFormatter hourMinuteSecondFraction()Returns a formatter for a two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (HH:mm:ss.SSS). Parsing will parse up to 9 fractional second digits, throwing away all except the first three.- Returns:
- a formatter for HH:mm:ss.SSS
-
dateHour
public static org.joda.time.format.DateTimeFormatter dateHour()Returns a formatter that combines a full date and two digit hour of day. (yyyy-MM-dd'T'HH)- Returns:
- a formatter for yyyy-MM-dd'T'HH
-
dateHourMinute
public static org.joda.time.format.DateTimeFormatter dateHourMinute()Returns a formatter that combines a full date, two digit hour of day, and two digit minute of hour. (yyyy-MM-dd'T'HH:mm)- Returns:
- a formatter for yyyy-MM-dd'T'HH:mm
-
dateHourMinuteSecond
public static org.joda.time.format.DateTimeFormatter dateHourMinuteSecond()Returns a formatter that combines a full date, two digit hour of day, two digit minute of hour, and two digit second of minute. (yyyy-MM-dd'T'HH:mm:ss)- Returns:
- a formatter for yyyy-MM-dd'T'HH:mm:ss
-
dateHourMinuteSecondMillis
public static org.joda.time.format.DateTimeFormatter dateHourMinuteSecondMillis()Returns a formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (yyyy-MM-dd'T'HH:mm:ss.SSS). Parsing will parse up to 3 fractional second digits.- Returns:
- a formatter for yyyy-MM-dd'T'HH:mm:ss.SSS
-
dateHourMinuteSecondFraction
public static org.joda.time.format.DateTimeFormatter dateHourMinuteSecondFraction()Returns a formatter that combines a full date, two digit hour of day, two digit minute of hour, two digit second of minute, and three digit fraction of second (yyyy-MM-dd'T'HH:mm:ss.SSS). Parsing will parse up to 9 fractional second digits, throwing away all except the first three.- Returns:
- a formatter for yyyy-MM-dd'T'HH:mm:ss.SSS
-