需求:当前日期减一
方法:
class="java"> public String DateConvert(Date date){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cld = Calendar.getInstance(); cld.setTime(date); cld.set(Calendar.DATE, cld.get(Calendar.DATE)-1); return sdf.format(cld.getTime()); }
?