SimpleDateFormat sdf = new SimpleDateFormat(“M月dd日”);
Calendar calendar = Calendar.getInstance(); //得到日历
calendar.setTime(calendar.getTime());//把当前时间赋给日历
calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
Date dBefore = calendar.getTime(); //得到前一天的时间

版权声明:本文为shenjun原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/shenjun/p/3146292.html