Date as = new Date(new Date().getTime()-24*60*60*1000);SimpleDateFormat matter1 = new SimpleDateFormat("yyyyMMdd");String time = matter1.format(as);System.out.println(time);结果20170412