ChronoLocalDate range() method in Java with Examples Last Updated : 29 Apr, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 ChronoLocalDate is helpful to enhance the accuracy of the returned range. Syntax: public ValueRange range(TemporalField field) Parameters: This method accepts one single parameter field which is the field to query the range for. Return value: This method returns ValueRange which is the range of valid values for the field, not null. Exception: This method throws following Exceptions: DateTimeException - if the range for the field cannot be obtained. UnsupportedTemporalTypeException - if the field is not supported. Below programs illustrate the range() method: Program 1: Java // Java program to demonstrate // ChronoLocalDate.range() method import java.time.*; import java.time.temporal.*; import java.time.chrono.*; public class GFG { public static void main(String[] args) { // create a ChronoLocalDate object ChronoLocalDate localD = LocalDate.parse("2018-12-06"); // print ChronoLocalDate System.out.println("ChronoLocalDate: " + localD); // get range of Days field // from ChronoLocalDate using range method ValueRange range = localD.range(ChronoField.DAY_OF_MONTH); // print range of DAY_OF_MONTH System.out.println("Range of DAY_OF_MONTH: " + range); } } Output: ChronoLocalDate: 2018-12-06 Range of DAY_OF_MONTH: 1 - 31 Program 2: Java // Java program to demonstrate // ChronoLocalDate.range() method import java.time.*; import java.time.temporal.*; import java.time.chrono.*; public class GFG { public static void main(String[] args) { // create a ChronoLocalDate object ChronoLocalDate localD = LocalDate.parse("2018-12-06"); // print ChronoLocalDate System.out.println("ChronoLocalDate: " + localD); // get range of DAY_OF_YEAR field // from ChronoLocalDate using range method ValueRange range = localD.range(ChronoField.DAY_OF_YEAR); // print range of DAY_OF_YEAR System.out.println("Range of DAY_OF_YEAR: " + range); } } Output: ChronoLocalDate: 2018-12-06 Range of DAY_OF_YEAR: 1 - 365 Reference: https://docs.oracle.com/javase/9/docs/api/java/time/temporal/TemporalAccessor.html#range-java.time.temporal.TemporalField- 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 range() method in Java with Examples The range() method of a ChronoLocalDateTime 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. This ChronoLocalDateTime is helpful to enhance the accuracy of 2 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 ChronoLocalDate query() Method in Java with Examples 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> q 2 min read ChronoField range() method in Java with Examples The range() method of ChronoField enum is used to return the range of valid values for the ChronoField constant.All fields of this range can be expressed as a long integer. Syntax: public ValueRange range() Parameters: This method accepts nothing. Return value: This method returns the range of valid 1 min read ChronoField range() method in Java with Examples The range() method of ChronoField enum is used to return the range of valid values for the ChronoField constant.All fields of this range can be expressed as a long integer. Syntax: public ValueRange range() Parameters: This method accepts nothing. Return value: This method returns the range of valid 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 Like