Calendar cal = Calendar.getInstance();
Calendar calClone = (Calendar) cal.clone();
calClone.set(Calendar.DAY_OF_YEAR, calClone.get(Calendar.DAY_OF_YEAR) - 1);
System.out.println(calClone.getTime());
calClone = (Calendar) cal.clone();
calClone.set(Calendar.MONTH, calClone.get(Calendar.MONTH) - 1);
System.out.println(calClone.getTime());
calClone = (Calendar) cal.clone();
calClone.set(Calendar.YEAR, calClone.get(Calendar.YEAR) - 1);
System.out.println(calClone.getTime());
如何得到一个日期的前一天日期
最新推荐文章于 2021-05-13 11:17:35 发布