Conversion date and time from a string in Java
Forums:
try {
String stringDate = "1945-05-09";
DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
Date victoryDate = format.parse(stringDate);
} catch (ParseException e) {
e.printStackTrace();
}
- Log in to post comments