时间类型转换 Date--->String
private Date collectTime;
private String stringDateTime;
public String getStringDateTime(){
String dateStr = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(collectTime);
return dateStr;
}
时间类型转换 String--> Date
private Date collectTime;
private String stringDateTime;
public String getCollectTime(){
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(stringDateTime);
return date;
}