Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH,1);//月份+1
Date time = cal.getTime()
cal.add(Calendar.YEAR,1);//年份+1
Date time = cal.getTime()
cal.add(Calendar.DATE,1);//天+1
Date time = cal.getTime()
//上个月
cal.set(Calendar.DAY_OF_MONTH,-1);//当前月的第几天
Date time = cal.getTime()
//其他以此类推
java日期增加和减少
最新推荐文章于 2024-07-29 03:27:35 发布