Month query(TemporalQuery query) example

Description

Month query(TemporalQuery<R> query) queries this month-of-year object using the specified query.

Syntax

query has the following syntax.


public <R> R query(TemporalQuery<R> query)

Example

The following example shows how to use query.


import java.time.LocalDate;
import java.time.Month;
import java.time.chrono.Chronology;
import java.time.temporal.TemporalQueries;
//from ww w.  j av  a 2s . com
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    Chronology n = m.query(TemporalQueries.chronology());
    System.out.println(n);

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset