日期字符串转换成时间戳
作者:互联网
时间戳转换
String format = "yyyy-MM-dd";
String dateStr = "2021-10-14";
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
String s = String.valueOf(sdf.parse(dateStr).getTime() / 1000);
System.out.println("sss:"+s);
} catch (ParseException e) {
e.printStackTrace();
}
标签:转换成,String,format,getTime,sdf,SimpleDateFormat,日期,dateStr,字符串 来源: https://blog.csdn.net/weixin_46522411/article/details/120737976