日期字符串转换成时间戳
时间戳转换
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(); }