public long gettimeStemp(String time, String format) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (!"".equals(format)) {
simpleDateFormat = new SimpleDateFormat(format);
}
long timeStemp = 0;
try {
Date date = simpleDateFormat.parse(time);
timeStemp = date.getTime();
} catch (ParseException e) {
e.printStackTrace();
}
return timeStemp;
}
Java 时间字符串转成时间戳
最新推荐文章于 2024-07-17 04:43:25 发布