日期加分钟返回该日期加分钟后的日期
- public static String addDateMinut(String day, int x) {
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 24小时制
- Date date = null;
- try {
- date = format.parse(day);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- if (date == null)
- return "";
- System.out.println("front:" + format.format(date));
- Calendar cal = Calendar.getInstance();
- cal.setTime(date);
- cal.add(Calendar.MINUTE, x);// 24小时制
- date = cal.getTime();
- System.out.println("after:" + format.format(date));
- cal = null;
- return format.format(date);
- }