Skip to content

Instantly share code, notes, and snippets.

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