Java Date Time - MonthDay query(TemporalQuery query) example








MonthDay query(TemporalQuery<R> query) queries this month-day 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.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 = MonthDay.now();
    Chronology n = m.query(TemporalQueries.chronology());
    System.out.println(n);

  }
}

The code above generates the following result.