How to convert string to date in java?
String string = ""January 2, 2010"";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(""MMMM d, yyyy"", Locale.ENGLISH);
LocalDate date = LocalDate.parse(string, formatter);
System.out.println(date); // 2010-01-02
🔗Source: stackoverflow.com
🔗Source: Java Interview Questions and Answers