如代码所示:
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() + 600000);
System.out.println(sdf.format(afterDate ));
方法二:
Calendar nowTime = Calendar.getInstance();
nowTime.add(Calendar.MINUTE, 6);
System.out.println(sdf.format(nowTime.getTime()));