public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date fprqDate = sdf.parse("20200101");
//今天的日期
Date nowDate = sdf.parse(new SimpleDateFormat("yyyyMMdd").format(new Date()));
long pDuration = (nowDate.getTime() - fprqDate.getTime())/(60*60*24*1000);
System.out.println("相差"+pDuration+"天");
}
输出为