/*
* 获取昨天日期 方法一,这个方法好像有点慢
*/
Date dt = new Date();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
time = new SimpleDateFormat( "yyyy-MM-dd").format(cal.getTime());
/*
* 获取昨天日期 方法二
*/
Date as = new Date(new Date().getTime()-24*60*60*1000);
SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
time = matter1.format(as);
原文地址:http://blog.csdn.net/wx3957156/article/details/39083153