public static String getSpecifiedDayBefore(String specifiedDay){
//SimpleDateFormat simpleDateFormat = new SimpleDateFormat(“yyyy-MM-dd”);
Calendar c = Calendar.getInstance();
Date date=null;
try {
date = new SimpleDateFormat(“yyyy-MM-dd”).parse(specifiedDay);
} catch (ParseException e) {
e.printStackTrace();
}
c.setTime(date);
int day=c.get(Calendar.DATE);
c.set(Calendar.DATE,day-1);
String dayBefore=new SimpleDateFormat(“yyyyMMdd”).format(c.getTime());
return dayBefore;
}
版权声明:本文为fhlxyzczq205301原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。