温故知新 将Date和String类型相互转换
//Date转String
public String DateToString(){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date day=new Date();
String daybyday=sdf.fromat(day);
return daybyday;
}
//String转Date(DateTimeFormatte jdk 1.8以后(线程安全))
public Date StringToDate(){
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDate date=LocalDate.parse("2019-11-11 11:11:11",dtf);
return date;
}