计算单位为毫秒,比如
一小时的时间戳
60X60X1000=3,600,000
同理一天的时间戳
86400000
日期转时间戳JAVA代码如下:
public static long dateToStamp(String s) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = simpleDateFormat.parse(s);
long ts = date.getTime();
return ts;
}
//long res = dateToStamp(“2021-10-17”);
//res =1634400000000
时间戳是从1970–01-01 00:00::00开始计算的。