字符串时间算时间差,单位秒
public static void main(String[] args) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date parse = format.parse("2023-01-11 12:12:12");
Date date = format.parse("2023-01-11 12:12:13");
long between = date.getTime() - parse.getTime();
//两个时间差 单位: 秒
System.out.println(between/ 1000);
}