Java Date Time - MonthDay query(TemporalQuery query) example

MonthDay query(TemporalQuery<R> query) queries this month-day using the specified query.


query has the following syntax.

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


The following example shows how to use query.

import java.time.MonthDay;
import java.time.chrono.Chronology;
import java.time.temporal.TemporalQueries;
//from   w w w  . j a  v a 2s.  c om
public class Main {
  public static void main(String[] args) {
    MonthDay m =;
    Chronology n = m.query(TemporalQueries.chronology());


The code above generates the following result.