Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, -1);
Date beforeDate = calendar.getTime();// 结果
SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd");
String time = df.format(beforeDate);
return time;
获取前一天时间
最新推荐文章于 2024-07-16 05:02:05 发布