ChronoLocalDate query() Method in Java with Examples Last Updated : 29 Apr, 2019 Comments Improve Suggest changes Like Article Like Report query() method of an ChronoLocalDate interface used to query this ChronoLocalDate using the specified query as parameter. The TemporalQuery object passed as parameter define the logic to be used to obtain the result from this ChronoLocalDate. Syntax: public <R> R query(TemporalQuery<R> query) Parameters: This method accepts only one parameter query which is the query to invoke. Return value: This method returns the query result, null may be returned. Exception: This method throws following Exceptions: DateTimeException - if unable to query . ArithmeticException - if numeric overflow occurs. Below programs illustrate the query() method: Program 1: Java // Java program to demonstrate // ChronoLocalDate.query() method import java.time.*; import java.time.temporal.*; import java.time.chrono.*; public class GFG { public static void main(String[] args) { // create ChronoLocalDate object ChronoLocalDate ld = LocalDate.parse("2018-12-31"); // apply the query method of ChronoLocalDate class String value = ld.query(TemporalQueries.precision()) .toString(); // print the result System.out.println("Precision value for ChronoLocalDate is " + value); } } Output: Precision value for ChronoLocalDate is Days Program 2: Showing if query did not found the required object then it returns null. Java // Java program to demonstrate // ChronoLocalDate.query() method import java.time.*; import java.time.temporal.*; import java.time.chrono.*; public class GFG { public static void main(String[] args) { // create ChronoLocalDate object ChronoLocalDate ld = LocalDate.parse("2018-12-31"); // apply query method of ChronoLocalDate class // print the result System.out.println("Zone value for ChronoLocalDate is " + ld.query( TemporalQueries.offset())); } } Output: Zone value for ChronoLocalDate is null References: https://docs.oracle.com/javase/9/docs/api/java/time/chrono/ChronoLocalDate.html#query-java.time.temporal.TemporalQuery- Comment More infoAdvertise with us Next Article ChronoLocalDate query() Method in Java with Examples K Kirti_Mangal Follow Improve Article Tags : Java Java-Functions Java-time package Java-ChronoLocalDate Practice Tags : Java Similar Reads ChronoLocalDateTime query() method in Java with Examples query() method of an ChronoLocalDateTime interface is used to query this ChronoLocalDateTime using the specified query as parameter. The TemporalQuery object passed as parameter define the logic to be used to obtain the result from this ChronoLocalDateTime. Syntax: default <R> R query(Temporal 2 min read ChronoLocalDate range() method in Java with Examples The range() method of a ChronoLocalDate interface is used to get the range of valid values for the field passes as a parameter. This method returns a ValueRange object which contains the minimum and maximum valid values for a field. When the field is not supported then an exception is thrown. This C 2 min read ChronoLocalDate toEpochDay() method in Java with Examples The toEpochDay() method of a ChronoLocalDate interface is used to get this date as a EpochDay. The EpochDay is the count of the day from the 0 EpochDay which is the 1970-01-01 (ISO). The output will be in the ISO-8601 format yyyy-MM-dd. Syntax: default long toEpochDay() Parameters: This method does 1 min read ChronoLocalDate get() method in Java with Examples The get() method of ChronoLocalDate interface in Java method gets the value of the specified field from this Date as an int. Syntax: public int get(TemporalField field) Parameter: This method accepts a parameter field which is the field to get and not necessary null. Return Value: It returns the val 2 min read ChronoLocalDate from() method in Java with Examples The from() method of ChronoLocalDate interface in Java method obtains an instance of ChronoLocalDate from a temporal object. Syntax: public static ChronoLocalDate from(TemporalAccessor temporal) Parameter: This method accepts a parameter temporal which specifies the temporal object to convert and no 1 min read ChronoLocalDate toString() method in Java with Examples The toString() method of a ChronoLocalDate interface is used to get this date as a String, such as 2019-01-01.The output will be in the ISO-8601 format uuuu-MM-dd. Syntax: public String toString() Parameters: This method does not accepts any parameters. Return value: This method returns String which 1 min read ChronoZonedDateTime query() method in Java with Examples query() method of an ChronoZonedDateTime interface used to query this ChronoZonedDateTime using the specified query as parameter.The TemporalQuery object passed as parameter define the logic to be used to obtain the result from this ChronoZonedDateTime. Syntax: default <R> R query(TemporalQuer 2 min read ChronoLocalDate getEra() method in Java with Examples The getEra() method of ChronoLocalDate interface in Java gets the era applicable at this date. Syntax: public Era getEra() Parameter: This method does not accepts any parameter. Return Value: The function returns the IsoChronology era constant applicable at this date and not null. Below programs ill 1 min read ChronoLocalDate format() method in Java with Examples The format() method of ChronoLocalDate interface in Java method formats this date using the specified formatter. Syntax: public String format(DateTimeFormatter formatter) Parameter: This method accepts a parameter obj which specifies the formatter to be used and it is not null. Exceptions: The funct 2 min read ChronoLocalDate isEqual() method in Java with Examples The isEqual() method of ChronoLocalDate interface in Java checks if this date is equal to the specified date or not. Syntax: public boolean isEqual(ChronoLocalDate date2) Parameter: This method accept a single mandatory parameter date2 the other date to compare to and not null. Return Value: The fun 1 min read Like