Object/Class

org.threeten.bp.format

DateTimeFormatter

Related Docs: class DateTimeFormatter | package format

Permalink

object DateTimeFormatter

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DateTimeFormatter
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val BASIC_ISO_DATE: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date without an offset, such as '20111203'.

    Returns the ISO date formatter that prints/parses a date without an offset, such as '20111203'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 basic local date format. The format consists of:

    • Four digits for the year. Only years in the range 0000 to 9999 are supported.
    • Two digits for the month-of-year. This is pre-padded by zero to ensure two digits.
    • Two digits for the day-of-month. This is pre-padded by zero to ensure two digits.
    • If the offset is not available to print/parse then the format is complete.
    • The offset ID without colons. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.

    As this formatter has an optional element, it may be necessary to parse using DateTimeFormatter#parseBest.

  5. val ISO_DATE: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date with the offset if available, such as '2011-12-03' or '2011-12-03+01:00'.

    Returns the ISO date formatter that prints/parses a date with the offset if available, such as '2011-12-03' or '2011-12-03+01:00'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended date format. The format consists of:

    • The #ISO_LOCAL_DATE
    • If the offset is not available to print/parse then the format is complete.
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.

    As this formatter has an optional element, it may be necessary to parse using DateTimeFormatter#parseBest.

  6. val ISO_DATE_TIME: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date-time with the offset and zone if available, such as '2011-12-03T10:15:30', '2011-12-03T10:15:30+01:00' or '2011-12-03T10:15:30+01:00[Europe/Paris]'.

    Returns the ISO date formatter that prints/parses a date-time with the offset and zone if available, such as '2011-12-03T10:15:30', '2011-12-03T10:15:30+01:00' or '2011-12-03T10:15:30+01:00[Europe/Paris]'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended offset date-time format. The format consists of:

    • The #ISO_LOCAL_DATE_TIME
    • If the offset is not available to print/parse then the format is complete.
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard.
    • If the zone ID is not available or is a ZoneOffset then the format is complete.
    • An open square bracket '['.
    • The zone ID. This is not part of the ISO-8601 standard. Parsing is case sensitive.
    • A close square bracket ']'.

    As this formatter has an optional element, it may be necessary to parse using DateTimeFormatter#parseBest.

  7. val ISO_INSTANT: DateTimeFormatter

    Permalink

    The ISO instant formatter that formats or parses an instant in UTC, such as '2011-12-03T10:15:30Z'.

    The ISO instant formatter that formats or parses an instant in UTC, such as '2011-12-03T10:15:30Z'.

    This returns an immutable formatter capable of formatting and parsing the ISO-8601 instant format. When formatting, the second-of-minute is always output. The nano-of-second outputs zero, three, six or nine digits digits as necessary. When parsing, time to at least the seconds field is required. Fractional seconds from zero to nine are parsed. The localized decimal style is not used.

    This is a special case formatter intended to allow a human readable form of an Instant. The Instant class is designed to only represent a point in time and internally stores a value in nanoseconds from a fixed epoch of 1970-01-01Z. As such, an Instant cannot be formatted as a date or time without providing some form of time-zone. This formatter allows the Instant to be formatted, by providing a suitable conversion using ZoneOffset.UTC.

    The format consists of:

    • The #ISO_OFFSET_DATE_TIME where the instant is converted from ChronoField#INSTANT_SECONDS and ChronoField#NANO_OF_SECOND using the UTC offset. Parsing is case insensitive.

    The returned formatter has no override chronology or zone. It uses the STRICT resolver style.

  8. val ISO_LOCAL_DATE: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date without an offset, such as '2011-12-03'.

    Returns the ISO date formatter that prints/parses a date without an offset, such as '2011-12-03'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended local date format. The format consists of:

    • Four digits or more for the year. Years in the range 0000 to 9999 will be pre-padded by zero to ensure four digits. Years outside that range will have a prefixed positive or negative symbol.
    • A dash
    • Two digits for the month-of-year. This is pre-padded by zero to ensure two digits.
    • A dash
    • Two digits for the day-of-month. This is pre-padded by zero to ensure two digits.
  9. val ISO_LOCAL_DATE_TIME: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date-time without an offset, such as '2011-12-03T10:15:30'.

    Returns the ISO date formatter that prints/parses a date-time without an offset, such as '2011-12-03T10:15:30'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended offset date-time format. The format consists of:

  10. val ISO_LOCAL_TIME: DateTimeFormatter

    Permalink

    Returns the ISO time formatter that prints/parses a time without an offset, such as '10:15' or '10:15:30'.

    Returns the ISO time formatter that prints/parses a time without an offset, such as '10:15' or '10:15:30'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended local time format. The format consists of:

    • Two digits for the hour-of-day. This is pre-padded by zero to ensure two digits.
    • A colon
    • Two digits for the minute-of-hour. This is pre-padded by zero to ensure two digits.
    • If the second-of-minute is not available to print/parse then the format is complete.
    • A colon
    • Two digits for the second-of-minute. This is pre-padded by zero to ensure two digits.
    • If the nano-of-second is zero or not available to print/parse then the format is complete.
    • A decimal point
    • One to nine digits for the nano-of-second. As many digits will be printed as required.
  11. val ISO_OFFSET_DATE: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date with an offset, such as '2011-12-03+01:00'.

    Returns the ISO date formatter that prints/parses a date with an offset, such as '2011-12-03+01:00'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended offset date format. The format consists of:

    • The #ISO_LOCAL_DATE
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.
  12. val ISO_OFFSET_DATE_TIME: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date-time with an offset, such as '2011-12-03T10:15:30+01:00'.

    Returns the ISO date formatter that prints/parses a date-time with an offset, such as '2011-12-03T10:15:30+01:00'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended offset date-time format. The format consists of:

    • The #ISO_LOCAL_DATE_TIME
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.
  13. val ISO_OFFSET_TIME: DateTimeFormatter

    Permalink

    Returns the ISO time formatter that prints/parses a time with an offset, such as '10:15+01:00' or '10:15:30+01:00'.

    Returns the ISO time formatter that prints/parses a time with an offset, such as '10:15+01:00' or '10:15:30+01:00'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended offset time format. The format consists of:

    • The #ISO_LOCAL_TIME
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.
  14. val ISO_ORDINAL_DATE: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses the ordinal date without an offset, such as '2012-337'.

    Returns the ISO date formatter that prints/parses the ordinal date without an offset, such as '2012-337'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended ordinal date format. The format consists of:

    • Four digits or more for the year. Years in the range 0000 to 9999 will be pre-padded by zero to ensure four digits. Years outside that range will have a prefixed positive or negative symbol.
    • A dash
    • Three digits for the day-of-year. This is pre-padded by zero to ensure three digits.
    • If the offset is not available to print/parse then the format is complete.
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.

    As this formatter has an optional element, it may be necessary to parse using DateTimeFormatter#parseBest.

  15. val ISO_TIME: DateTimeFormatter

    Permalink

    Returns the ISO time formatter that prints/parses a time, with the offset if available, such as '10:15', '10:15:30' or '10:15:30+01:00'.

    Returns the ISO time formatter that prints/parses a time, with the offset if available, such as '10:15', '10:15:30' or '10:15:30+01:00'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended offset time format. The format consists of:

    • The #ISO_LOCAL_TIME
    • If the offset is not available to print/parse then the format is complete.
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.

    As this formatter has an optional element, it may be necessary to parse using DateTimeFormatter#parseBest.

  16. val ISO_WEEK_DATE: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses the week-based date without an offset, such as '2012-W48-6'.

    Returns the ISO date formatter that prints/parses the week-based date without an offset, such as '2012-W48-6'.

    This returns an immutable formatter capable of printing and parsing the ISO-8601 extended week-based date format. The format consists of:

    • Four digits or more for the week-based-year. Years in the range 0000 to 9999 will be pre-padded by zero to ensure four digits. Years outside that range will have a prefixed positive or negative symbol.
    • A dash
    • The letter 'W'. Parsing is case insensitive.
    • Two digits for the week-of-week-based-year. This is pre-padded by zero to ensure three digits.
    • A dash
    • One digit for the day-of-week. The value run from Monday (1) to Sunday (7).
    • If the offset is not available to print/parse then the format is complete.
    • The offset ID. If the offset has seconds then they will be handled even though this is not part of the ISO-8601 standard. Parsing is case insensitive.

    As this formatter has an optional element, it may be necessary to parse using DateTimeFormatter#parseBest.

  17. val ISO_ZONED_DATE_TIME: DateTimeFormatter

    Permalink

    Returns the ISO date formatter that prints/parses a date-time with offset and zone, such as '2011-12-03T10:15:30+01:00[Europe/Paris]'.

    Returns the ISO date formatter that prints/parses a date-time with offset and zone, such as '2011-12-03T10:15:30+01:00[Europe/Paris]'.

    This returns an immutable formatter capable of printing and parsing a format that extends the ISO-8601 extended offset date-time format to add the time-zone. The format consists of:

    • The #ISO_OFFSET_DATE_TIME
    • If the zone ID is not available or is a ZoneOffset then the format is complete.
    • An open square bracket '['.
    • The zone ID. This is not part of the ISO-8601 standard. Parsing is case sensitive.
    • A close square bracket ']'.
  18. val RFC_1123_DATE_TIME: DateTimeFormatter

    Permalink

    Returns the RFC-1123 date-time formatter, such as 'Tue, 3 Jun 2008 11:05:30 GMT'.

    Returns the RFC-1123 date-time formatter, such as 'Tue, 3 Jun 2008 11:05:30 GMT'.

    This returns an immutable formatter capable of printing and parsing most of the RFC-1123 format. RFC-1123 updates RFC-822 changing the year from two digits to four. This implementation requires a four digit year. This implementation also does not handle North American or military zone names, only 'GMT' and offset amounts.

    The format consists of:

    • If the day-of-week is not available to print/parse then jump to day-of-month.
    • Three letter day-of-week in English.
    • A comma
    • A space
    • One or two digits for the day-of-month.
    • A space
    • Three letter month-of-year in English.
    • A space
    • Four digits for the year. Only years in the range 0000 to 9999 are supported.
    • A space
    • Two digits for the hour-of-day. This is pre-padded by zero to ensure two digits.
    • A colon
    • Two digits for the minute-of-hour. This is pre-padded by zero to ensure two digits.
    • If the second-of-minute is not available to print/parse then jump to the next space.
    • A colon
    • Two digits for the second-of-minute. This is pre-padded by zero to ensure two digits.
    • A space
    • The offset ID without colons or seconds. An offset of zero uses "GMT". North American zone names and military zone names are not handled.

    Parsing is case insensitive.

  19. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  20. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  23. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  25. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. def ofLocalizedDate(dateStyle: FormatStyle): DateTimeFormatter

    Permalink

    Returns a locale specific date format.

    Returns a locale specific date format.

    This returns a formatter that will print/parse a date. The exact format pattern used varies by locale.

    The locale is determined from the formatter. The formatter returned directly by this method will use the default locale. The locale can be controlled using withLocale(Locale) on the result of this method.

    Note that the localized pattern is looked up lazily. This DateTimeFormatter holds the style required and the locale, looking up the pattern required on demand.

    dateStyle

    the formatter style to obtain, not null

    returns

    the date formatter, not null

  31. def ofLocalizedDateTime(dateStyle: FormatStyle, timeStyle: FormatStyle): DateTimeFormatter

    Permalink

    Returns a locale specific date and time format.

    Returns a locale specific date and time format.

    This returns a formatter that will print/parse a date-time. The exact format pattern used varies by locale.

    The locale is determined from the formatter. The formatter returned directly by this method will use the default locale. The locale can be controlled using withLocale(Locale) on the result of this method.

    Note that the localized pattern is looked up lazily. This DateTimeFormatter holds the style required and the locale, looking up the pattern required on demand.

    dateStyle

    the date formatter style to obtain, not null

    timeStyle

    the time formatter style to obtain, not null

    returns

    the date, time or date-time formatter, not null

  32. def ofLocalizedDateTime(dateTimeStyle: FormatStyle): DateTimeFormatter

    Permalink

    Returns a locale specific date-time format, which is typically of short length.

    Returns a locale specific date-time format, which is typically of short length.

    This returns a formatter that will print/parse a date-time. The exact format pattern used varies by locale.

    The locale is determined from the formatter. The formatter returned directly by this method will use the default locale. The locale can be controlled using withLocale(Locale) on the result of this method.

    Note that the localized pattern is looked up lazily. This DateTimeFormatter holds the style required and the locale, looking up the pattern required on demand.

    dateTimeStyle

    the formatter style to obtain, not null

    returns

    the date-time formatter, not null

  33. def ofLocalizedTime(timeStyle: FormatStyle): DateTimeFormatter

    Permalink

    Returns a locale specific time format.

    Returns a locale specific time format.

    This returns a formatter that will print/parse a time. The exact format pattern used varies by locale.

    The locale is determined from the formatter. The formatter returned directly by this method will use the default locale. The locale can be controlled using withLocale(Locale) on the result of this method.

    Note that the localized pattern is looked up lazily. This DateTimeFormatter holds the style required and the locale, looking up the pattern required on demand.

    timeStyle

    the formatter style to obtain, not null

    returns

    the time formatter, not null

  34. def ofPattern(pattern: String, locale: Locale): DateTimeFormatter

    Permalink

    Creates a formatter using the specified pattern.

    Creates a formatter using the specified pattern.

    This method will create a formatter based on a simple pattern of letters and symbols. For example, d MMM yyyy will format 2011-12-03 as '3 Dec 2011'.

    See #ofPattern(String) for details of the pattern.

    The returned formatter will use the specified locale, but this can be changed using DateTimeFormatter#withLocale(Locale).

    pattern

    the pattern to use, not null

    locale

    the locale to use, not null

    returns

    the formatter based on the pattern, not null

    Exceptions thrown

    IllegalArgumentException if the pattern is invalid

    See also

    DateTimeFormatterBuilder#appendPattern(String)

  35. def ofPattern(pattern: String): DateTimeFormatter

    Permalink

    Creates a formatter using the specified pattern.

    Creates a formatter using the specified pattern.

    This method will create a formatter based on a simple pattern of letters and symbols. For example, d MMM yyyy will format 2011-12-03 as '3 Dec 2011'.

    The returned formatter will use the default locale, but this can be changed using DateTimeFormatter#withLocale(Locale).

    All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters. The following pattern letters are defined:

    Symbol  Meaning                     Presentation      Examples
    ------  -------                     ------------      -------
    G       era                         number/text       1; 01; AD; Anno Domini
    y       year                        year              2004; 04
    D       day-of-year                 number            189
    M       month-of-year               number/text       7; 07; Jul; July; J
    d       day-of-month                number            10
    
    Q       quarter-of-year             number/text       3; 03; Q3
    Y       week-based-year             year              1996; 96
    w       week-of-year                number            27
    W       week-of-month               number            27
    e       localized day-of-week       number            2; Tue; Tuesday; T
    E       day-of-week                 number/text       2; Tue; Tuesday; T
    F       week-of-month               number            3
    
    a       am-pm-of-day                text              PM
    h       clock-hour-of-am-pm (1-12)  number            12
    K       hour-of-am-pm (0-11)        number            0
    k       clock-hour-of-am-pm (1-24)  number            0
    
    H       hour-of-day (0-23)          number            0
    m       minute-of-hour              number            30
    s       second-of-minute            number            55
    S       fraction-of-second          fraction          978
    A       milli-of-day                number            1234
    n       nano-of-second              number            987654321
    N       nano-of-day                 number            1234000000
    
    V       time-zone ID                zone-id           America/Los_Angeles; Z; -08:30
    z       time-zone name              zone-name         Pacific Standard Time; PST
    X       zone-offset 'Z' for zero    offset-X          Z; -08; -0830; -08:30; -083015; -08:30:15;
    x       zone-offset                 offset-x          +0000; -08; -0830; -08:30; -083015; -08:30:15;
    Z       zone-offset                 offset-Z          +0000; -0800; -08:00;
    
    p       pad next                    pad modifier      1
    
    '       escape for text             delimiter
    ''      single quote                literal           '
    [       optional section start
    ]       optional section end
    {}      reserved for future use
    

    The count of pattern letters determine the format.

    Text: The text style is determined based on the number of pattern letters used. Less than 4 pattern letters will use the short form. Exactly 4 pattern letters will use the full form. Exactly 5 pattern letters will use the narrow form.

    Number: If the count of letters is one, then the value is printed using the minimum number of digits and without padding as per DateTimeFormatterBuilder#appendValue(TemporalField). Otherwise, the count of digits is used as the width of the output field as per int).

    Number/Text: If the count of pattern letters is 3 or greater, use the Text rules above. Otherwise use the Number rules above.

    Fraction: Outputs the nano-of-second field as a fraction-of-second. The nano-of-second value has nine digits, thus the count of pattern letters is from 1 to 9. If it is less than 9, then the nano-of-second value is truncated, with only the most significant digits being output. When parsing in strict mode, the number of parsed digits must match the count of pattern letters. When parsing in lenient mode, the number of parsed digits must be at least the count of pattern letters, up to 9 digits.

    Year: The count of letters determines the minimum field width below which padding is used. If the count of letters is two, then a reduced two digit form is used. For printing, this outputs the rightmost two digits. For parsing, this will parse using the base value of 2000, resulting in a year within the range 2000 to 2099 inclusive. If the count of letters is less than four (but not two), then the sign is only output for negative years as per SignStyle#NORMAL. Otherwise, the sign is output if the pad width is exceeded, as per SignStyle#EXCEEDS_PAD

    ZoneId: This outputs the time-zone ID, such as 'Europe/Paris'. If the count of letters is two, then the time-zone ID is output. Any other count of letters throws IllegalArgumentException.

    Zone names: This outputs the display name of the time-zone ID. If the count of letters is one, two or three, then the short name is output. If the count of letters is four, then the full name is output. Five or more letters throws IllegalArgumentException.

    Offset X and x: This formats the offset based on the number of pattern letters. One letter outputs just the hour', such as '+01', unless the minute is non-zero in which case the minute is also output, such as '+0130'. Two letters outputs the hour and minute, without a colon, such as '+0130'. Three letters outputs the hour and minute, with a colon, such as '+01:30'. Four letters outputs the hour and minute and optional second, without a colon, such as '+013015'. Five letters outputs the hour and minute and optional second, with a colon, such as '+01:30:15'. Six or more letters throws IllegalArgumentException. Pattern letter 'X' (upper case) will output 'Z' when the offset to be output would be zero, whereas pattern letter 'x' (lower case) will output '+00', '+0000', or '+00:00'.

    Offset Z: This formats the offset based on the number of pattern letters. One, two or three letters outputs the hour and minute, without a colon, such as '+0130'. Four or more letters throws IllegalArgumentException. The output will be '+0000' when the offset is zero.

    Optional section: The optional section markers work exactly like calling DateTimeFormatterBuilder#optionalStart() and DateTimeFormatterBuilder#optionalEnd().

    Pad modifier: Modifies the pattern that immediately follows to be padded with spaces. The pad width is determined by the number of pattern letters. This is the same as calling DateTimeFormatterBuilder#padNext(int).

    For example, 'ppH' outputs the hour-of-day padded on the left with spaces to a width of 2.

    Any unrecognized letter is an error. Any non-letter character, other than '[', ']', '{', '}' and the single quote will be output directly. Despite this, it is recommended to use single quotes around all characters that you want to output directly to ensure that future changes do not break your application.

    pattern

    the pattern to use, not null

    returns

    the formatter based on the pattern, not null

    Exceptions thrown

    IllegalArgumentException if the pattern is invalid

    See also

    DateTimeFormatterBuilder#appendPattern(String)

  36. def parsedExcessDays: TemporalQuery[Period]

    Permalink

    A query that provides access to the excess days that were parsed.

    A query that provides access to the excess days that were parsed.

    This returns a singleton query that provides access to additional information from the parse. The query always returns a non-null period, with a zero period returned instead of null.

    There are two situations where this query may return a non-zero period.

    • If the ResolverStyle is LENIENT and a time is parsed without a date, then the complete result of the parse consists of a LocalTime and an excess Period in days.
    • If the ResolverStyle is SMART and a time is parsed without a date where the time is 24:00:00, then the complete result of the parse consists of a LocalTime of 00:00:00 and an excess Period of one day.

    In both cases, if a complete ChronoLocalDateTime or Instant is parsed, then the excess days are added to the date part. As a result, this query will return a zero period.

    The SMART behaviour handles the common "end of day" 24:00 value. Processing in LENIENT mode also produces the same result:

    Text to parse        Parsed object                         Excess days
    "2012-12-03T00:00"   LocalDateTime.of(2012, 12, 3, 0, 0)   ZERO
    "2012-12-03T24:00"   LocalDateTime.of(2012, 12, 4, 0, 0)   ZERO
    "00:00"              LocalTime.of(0, 0)                    ZERO
    "24:00"              LocalTime.of(0, 0)                    Period.ofDays(1)
    
    The query can be used as follows:
    TemporalAccessor parsed = formatter.parse(str);
    LocalTime time = parsed.query(LocalTime.FROM);
    Period extraDays = parsed.query(DateTimeFormatter.parsedExcessDays());
    

    returns

    a query that provides access to the excess days that were parsed

  37. def parsedLeapSecond: TemporalQuery[Boolean]

    Permalink

    A query that provides access to whether a leap-second was parsed.

    A query that provides access to whether a leap-second was parsed.

    This returns a singleton query that provides access to additional information from the parse. The query always returns a non-null boolean, true if parsing saw a leap-second, false if not.

    Instant parsing handles the special "leap second" time of '23:59:60'. Leap seconds occur at '23:59:60' in the UTC time-zone, but at other local times in different time-zones. To avoid this potential ambiguity, the handling of leap-seconds is limited to DateTimeFormatterBuilder#appendInstant(), as that method always parses the instant with the UTC zone offset.

    If the time '23:59:60' is received, then a simple conversion is applied, replacing the second-of-minute of 60 with 59. This query can be used on the parse result to determine if the leap-second adjustment was made. The query will return one second of excess if it did adjust to remove the leap-second, and zero if not. Note that applying a leap-second smoothing mechanism, such as UTC-SLS, is the responsibility of the application, as follows:

    TemporalAccessor parsed = formatter.parse(str);
    Instant instant = parsed.query(Instant::from);
    if (parsed.query(DateTimeFormatter.parsedLeapSecond())) {
    // validate leap-second is correct and apply correct smoothing
    }
    

    returns

    a query that provides access to whether a leap-second was parsed

  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  39. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  40. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped