
//String格式的数据转化成Date格式,Date格式转化成String格式
SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = formatter.parse("1969-01-01 00:00:00");//Date格式
System.out.println(date);
String datestr= formatter.format(date);//String格式
System.out.println(datestr);
} catch (ParseException e) {
e.printStackTrace();
}