问题
When we convert the date from yyyy-MM-dd'T'HH:mm:ssXXX to YYMMDD date is invalid.
Say.. If the date is 2019-02-27T12:52:58.249Z then the converted date is generated as "190258"
回答1:
The issue is because of 'D' in the input format.
D represents Day of the year - so when we give 2019-02-27 it adds the 31 days in Jan and 27 days in Feb so the day is counted as '58'.
After changing the format to 'd' it works fine.
Similarly, 'Y' represents week of the year - so we have replaced that to 'y' which represents year
来源:https://stackoverflow.com/questions/54918883/invalid-date-is-populated-when-we-use-yyyy-mm-ddthhmmssxxx-format-in-java