更新时间:2023-01-23 08:35:45
为什么不一直使用普通的Date
?
Why not use a normal Date
all along?
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, -7);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String output = formatter.format(cal.getTime());