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())); }