Chuyển đổi String ↔ Date với SimpleDateFormat
static Date convertStringToDate(String str) {
try {
return new SimpleDateFormat("dd/MM/yyyy").parse(str);
} catch (ParseException e) {
System.out.println(e.getMessage());
}
return null;
}
static String convertDateToString(Date d) {
return new SimpleDateFormat("dd/MM/yyyy").format(d);
}