当前时间加?分钟

 public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date now = new Date();
        System.out.println("当前时间:" + sdf.format(now));

        Date afterDate = new Date(now.getTime() + 300000);
        System.out.println(sdf.format(afterDate));

        Calendar nowTime = Calendar.getInstance();
        nowTime.add(Calendar.MINUTE, 5);
        System.out.println(sdf.format(nowTime.getTime()));

    }

 

posted @ 2021-07-26 17:48  安详的苦丁茶  阅读(49)  评论(0编辑  收藏  举报