问题描述
2020 年 7 月 1 日是中国共产党成立 99 周年纪念日。
中国共产党成立于 1921 年 7 月 23 日。
请问从 1921 年 7 月 23 日中午 12 时到 2020 年 7 月 1 日中午 12 时一共包
含多少分钟?
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test {
public static void main(String[] args) throws ParseException {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date start = format.parse("1921-7-23 12:00:00");
Date end = format.parse("2020-7-1 12:00:00");
System.out.print(((end.getTime() - start.getTime()) / 1000 / 60 / 60) * 60);
}
}
最后再补充一个小技巧:
EXCLE yyds