java获取俩个日期间隔天数

public static void main(String[] args) {
        String start = "2021-01-20";
        String end = "2021-02-01";

        LocalDate parseStart = LocalDate.parse(start);
        LocalDate parseEnd = LocalDate.parse(end);
        //相隔天数
        long days = parseEnd.toEpochDay() - parseStart.toEpochDay();
        //12
        System.out.println(days);
    }
相关推荐
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页