Java tutorial
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; public class Main { public static void main(String[] args) { TemporalQuery<TemporalUnit> precision = TemporalQueries.precision(); System.out.println(LocalDate.now().query(precision)); // Days System.out.println(LocalTime.now().query(precision)); // Nanos System.out.println(YearMonth.now().query(precision)); // Months } }