0 votes
in JAVA by
How to convert string to date in java?

1 Answer

0 votes
by

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

Related questions

0 votes
asked Oct 20, 2020 in JAVA by sharadyadav1986
0 votes
asked Oct 18, 2020 in JAVA by sharadyadav1986
...