java中yyyy年MM月DD日 HH:mm:ss 转成时间戳
public static long dateToMs(String _date,String pattern) {
SimpleDateFormat format = new SimpleDateFormat(pattern,Locale.getDefault());
try {
Date date = format.parse(_date);
return date.getTime();
} catch (Exception e) {
return 0;
}
}
long dateLong = dateToMs(“2021年02月02日”, "yyyy年MM月dd日 HH:mm:ss");