Uses of Interface java.time.temporal.TemporalQuery (Java Platform SE 8 )
Date: 2026-04-17

## Uses of Interface
java.time.temporal.TemporalQuery

- Packages that use TemporalQuery
  Package | Description
  --- | ---
  java.time | The main API for dates, times, instants, and durations.
  java.time.chrono | Generic API for calendar systems other than the default ISO.
  java.time.format | Provides classes to print and parse dates and times.
  java.time.temporal | Access to date and time using fields and units, and date time adjusters.

- - ### Uses of TemporalQuery in java.time

    Methods in java.time with parameters of type TemporalQuery
    Modifier and Type | Method and Description
    --- | ---
    `<R> R` | Month.`query(TemporalQuery<R> query)` Queries this month-of-year using the specified query.
    `<R> R` | MonthDay.`query(TemporalQuery<R> query)` Queries this month-day using the specified query.
    `<R> R` | LocalDateTime.`query(TemporalQuery<R> query)` Queries this date-time using the specified query.
    `<R> R` | OffsetTime.`query(TemporalQuery<R> query)` Queries this time using the specified query.
    `<R> R` | ZonedDateTime.`query(TemporalQuery<R> query)` Queries this date-time using the specified query.
    `<R> R` | ZoneOffset.`query(TemporalQuery<R> query)` Queries this offset using the specified query.
    `<R> R` | LocalTime.`query(TemporalQuery<R> query)` Queries this time using the specified query.
    `<R> R` | OffsetDateTime.`query(TemporalQuery<R> query)` Queries this date-time using the specified query.
    `<R> R` | DayOfWeek.`query(TemporalQuery<R> query)` Queries this day-of-week using the specified query.
    `<R> R` | Instant.`query(TemporalQuery<R> query)` Queries this instant using the specified query.
    `<R> R` | Year.`query(TemporalQuery<R> query)` Queries this year using the specified query.
    `<R> R` | YearMonth.`query(TemporalQuery<R> query)` Queries this year-month using the specified query.
    `<R> R` | LocalDate.`query(TemporalQuery<R> query)` Queries this date using the specified query.

  - ### Uses of TemporalQuery in java.time.chrono

    Methods in java.time.chrono with parameters of type TemporalQuery
    Modifier and Type | Method and Description
    --- | ---
    `default <R> R` | ChronoZonedDateTime.`query(TemporalQuery<R> query)` Queries this date-time using the specified query.
    `default <R> R` | ChronoLocalDate.`query(TemporalQuery<R> query)` Queries this date using the specified query.
    `default <R> R` | Era.`query(TemporalQuery<R> query)` Queries this era using the specified query.
    `default <R> R` | ChronoLocalDateTime.`query(TemporalQuery<R> query)` Queries this date-time using the specified query.

  - ### Uses of TemporalQuery in java.time.format

    Methods in java.time.format that return TemporalQuery
    Modifier and Type | Method and Description
    --- | ---
    `static TemporalQuery<Period>` | DateTimeFormatter.`parsedExcessDays()` A query that provides access to the excess days that were parsed.
    `static TemporalQuery<Boolean>` | DateTimeFormatter.`parsedLeapSecond()` A query that provides access to whether a leap-second was parsed.

    Methods in java.time.format with parameters of type TemporalQuery
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | DateTimeFormatter.`parse(CharSequence text, TemporalQuery<T> query)` Fully parses the text producing an object of the specified type.
    `TemporalAccessor` | DateTimeFormatter.`parseBest(CharSequence text, TemporalQuery<?>... queries)` Fully parses the text producing an object of one of the specified types.
    `Format` | DateTimeFormatter.`toFormat(TemporalQuery<?> parseQuery)` Returns this formatter as a `java.text.Format` instance that will parse using the specified query.

  - ### Uses of TemporalQuery in java.time.temporal

    Methods in java.time.temporal that return TemporalQuery
    Modifier and Type | Method and Description
    --- | ---
    `static TemporalQuery<Chronology>` | TemporalQueries.`chronology()` A query for the `Chronology`.
    `static TemporalQuery<LocalDate>` | TemporalQueries.`localDate()` A query for `LocalDate` returning null if not found.
    `static TemporalQuery<LocalTime>` | TemporalQueries.`localTime()` A query for `LocalTime` returning null if not found.
    `static TemporalQuery<ZoneOffset>` | TemporalQueries.`offset()` A query for `ZoneOffset` returning null if not found.
    `static TemporalQuery<TemporalUnit>` | TemporalQueries.`precision()` A query for the smallest supported unit.
    `static TemporalQuery<ZoneId>` | TemporalQueries.`zone()` A lenient query for the `ZoneId`, falling back to the `ZoneOffset`.
    `static TemporalQuery<ZoneId>` | TemporalQueries.`zoneId()` A strict query for the `ZoneId`.

    Methods in java.time.temporal with parameters of type TemporalQuery
    Modifier and Type | Method and Description
    --- | ---
    `default <R> R` | TemporalAccessor.`query(TemporalQuery<R> query)` Queries this date-time.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.