String 转 Date
String string= "2020-5-27 13:57:45";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") ;
Date date = simpleDateFormat.parse(string);
Date 转 String
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") ;
String string = simpleDateFormat.format(date)
时间戳 转 Date
Date date = new Date(longtime);
Date 转 时间戳
long longtime = date.getTime();