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); }
Java 返回一个日期加多少分钟后的日期
最新推荐文章于 2022-06-19 19:03:08 发布