Skip to content

Instantly share code, notes, and snippets.

@adojos
Last active March 9, 2023 11:01
Show Gist options
  • Save adojos/dad430fbf471a3357dc0f4be9a99dfdd to your computer and use it in GitHub Desktop.
Save adojos/dad430fbf471a3357dc0f4be9a99dfdd to your computer and use it in GitHub Desktop.
Java: Convert String to Date Using DateTimeFormatter #java
private static void convertToLocalDateWithDateFormatter() {
String strDate = "06/12/2015";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDate date = LocalDate.parse(strDate,formatter);
System.out.println(date);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment