Java Data Type How to - Get Temporal Queries precision


We would like to know how to get Temporal Queries precision.


import java.time.LocalDate;
import java.time.LocalTime;
import java.time.YearMonth;
import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalQuery;
import java.time.temporal.TemporalUnit;
//  www.j  a  va2s .co  m
public class Main {

  public static void main(String[] args) {

    TemporalQuery<TemporalUnit> precision = TemporalQueries.precision();
    System.out.println(; // Days
    System.out.println(; // Nanos
    System.out.println(; // Months


The code above generates the following result.