Returns the local date instance according to provided text. The text must be valid per provided DateTimeFormatter instance.
package com.logicbig.example.localdate;
import java.time.LocalDate;
public class ParseExample2 {
public static void main (String... args) {
LocalDate d = LocalDate.parse("1987-6-25");
System.out.println(d);
}
}
Output
Caused by: java.time.format.DateTimeParseException: Text '1987-6-25' could not be parsed at index 5
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
at java.time.LocalDate.parse(LocalDate.java:400)
at java.time.LocalDate.parse(LocalDate.java:385)
at com.logicbig.example.localdate.ParseExample2.main(ParseExample2.java:13)
... 6 more