java.time.temporal.TemporalQueries Class in Java Last Updated : 28 Mar, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The TemporalQueries Class provides common implementations of querying the temporal objects. The implementation defines the logic of the query. Queries are a key tool for retrieving information from temporal objects. For example, a query that checks if the date is the day before February 29th in a leap year, or determine if time lies between business hours or not. There are two equivalent ways of using a TemporalQuery: 1. Invoke the method on this interface directly: temporal = thisQuery.queryFrom(temporal);2. use TemporalAccessor.query(TemporalQuery): temporal = temporal.query(thisQuery);Class declaration: public final class TemporalQueries extends Object TemporalQueries Class inherits following methods from class java.lang.Object: clone()equals()finalize()getClass()hashCode()notify()notifyAll()toString()wait()Methods of TemporalQueries Class: MethodDescriptionchronology()This method returns a query for the Chronology.localDate()This method returns a query for LocalDate returning null if not found.localTime()This method returns a query for LocalTime returning null if not found.offset()This method returns a query for ZoneOffset returning null if not found.precision()This method returns a query for the smallest supported unit.zone()This method returns a lenient query for the ZoneId, falling back to the ZoneOffset.zoneId()This method returns a lenient query for the ZoneId, falling back to the ZoneOffset. Java // Java program to demonstrate // TemporalQueries Class import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.Year; import java.time.YearMonth; import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; public class GFG { public static void main(String[] args) { // creating a query to obtainsmallest supported unit // of a temporal TemporalQuery<TemporalUnit> precision = TemporalQueries.precision(); System.out.println("TemporalQueries precision: "); // print smallest precision of local date System.out.println( LocalDate.now().query(precision)); // print smallest precision of local time System.out.println( LocalTime.now().query(precision)); // print smallest precision of local date-time System.out.println( LocalDateTime.now().query(precision)); // print smallest precision of year-month System.out.println( YearMonth.now().query(precision)); // print smallest precision of year System.out.println(Year.now().query(precision)); } } OutputTemporalQueries precision: Days Nanos Nanos Months Years Comment More infoAdvertise with us Next Article java.time.LocalDate Class in Java S surbhityagi15 Follow Improve Article Tags : Java Java-time package Practice Tags : Java Similar Reads java.time.temporal.TemporalAdjusters Class in Java TemporalAdjusters Class in Java provides Adjusters, which are a key tool for modifying temporal objects. Examples include an adjuster that sets the date like âSecond Saturday of the Monthâ or âNext Tuesdayâ, or one that sets the date to the last day of the month. TemporalAdjuster can be used in two 4 min read java.time.temporal.ValueRange Class in Java The ValueRange Class captures the valid range of the values of TemporalField instances. Given class provides the minimum and maximum values of the range. Note: It's possible that there might be invalid values within the outer range. For example, a field may have valid values of 1, 2, 3, 6, 7, thus h 3 min read java.time.LocalTime Class in Java Java is the most popular programming language and widely used programming language. Java is used in all kinds of applications like mobile applications, desktop applications, web applications. As in Java, java.time.LocalTime class represents time, which is viewed as hour-minute-second. This class is 5 min read java.time.LocalDateTime Class in Java java.time.LocalDateTime class, introduced in Java 8, represents a local date-time object without timezone information. The LocalDateTime class in Java is an immutable date-time object that represents a date in the yyyy-MM-dd-HH-mm-ss.zzz format. It implements the ChronoLocalDateTime interface and in 4 min read java.time.LocalDate Class in Java Java is the most popular programming language and widely used programming language. Java is used in all kind of application like as mobile application, desktop application, web application. In this Java java.time.LocalDate class is imported which represents to display the current date. java.time: It 4 min read java.time.Period Class in Java The Period Class in Java class obtains a quantity or amount of time in terms of years, months and days. The time obtained is a date-based amount of time in the ISO-8601 calendar system, such as '4 years, 5 months, and 6 days. The units which are supported for a period are YEARS, MONTHS, and days. Al 5 min read Like