如图:传入日期是“2021-12-02”,输出日期却是“2020-11-02”
public static void main(String[] args) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
try {
System.out.println(dateFormat.parse("2021-12-02"));
} catch (ParseException e) {
e.printStackTrace();
}
}
输出结果
Mon Nov 02 00:00:00 CST 2020
Process finished with exit code 0