Java日期计算

 

Date now = java.sql.Date.valueOf("2008-12-04");

System.out.println("now========" + now.toString());

Calendar cd = Calendar.getInstance(); cd.setTime(now);

cd.add(cd.DATE, 30);

Date nextday = cd.getTime();

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

System.out.println("next========" + sdf.format(nextday));

你可能感兴趣的:(java,sql)