java计算日期+1天

it2023-05-05  76

public static Date DateAddOneDay(Date sDate) throws ParseException { /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date sDate = sdf.parse(endDate);*/ Calendar c = Calendar.getInstance(); c.setTime(sDate); c.add(Calendar.DAY_OF_MONTH, 1); //利用Calendar 实现 Date日期+1天 sDate = c.getTime(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); return sDate; }
最新回复(0)