public static void main(String[] args) throws ParseException {
var d=new Date();
var c=Calendar.getInstance();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(d));
System.out.println(sdf.format(c.getTime()));
String date="1997-12-31";
SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd");
System.out.println(sdf.format(sdf2.parse(date)));
SimpleDateFormat sdf3=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String d1="1997-12-30 00:00:00";
String d2="2020-12-31 00:00:00";
long num=sdf3.parse(d2).getTime()-sdf3.parse(d1).getTime();
System.out.printf("%n %s距离%s 共%d天",d1,d2,num/1000/60/60/24);
}