SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, -1);
date = calendar.getTime();
System.out.println(sdf.format(date));
获取当前时间的前一天 java
最新推荐文章于 2024-08-12 02:05:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)