Reference:

In those years we stepped into the hole – Java Date daylight saving time Date conversion inconsistency

The whole network is the most complete! Thoroughly understand Java processing GMT/UTC date time – Bloggarden

Summary of troubleshooting a bug that causes interface output date format time to be inconsistent with the expected time due to JDK DST

Daylight saving Time: referenceBaike.baidu.com/item/%E5%A4…

Solutions:

1. Recommended Methods:

What is the difference between Asia/Shanghai and GMT+8? GMT+8 is east 8, Beijing time is the same as east 8. Asia/Shanghai is called CST in China when it is a regional standard already named. This regional standard will be compatible with all historical time points. China implemented daylight saving time from 1986 to 1991, the difference between summer and winter is 1 hour, Asia/Shanghai will be compatible with this time period. Conclusion: After 1992, GMT+8 was the same time as Asia/Shanghai in China, and there was an hour time difference in summer between 1986 and 1991. ———————————————— Copyright notice: This article is originally published BY CSDN blogger “Jiyu Ge”, in accordance with CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement. Original link: blog.csdn.net/zjy_love_ja…

The time zone consistency problem is resolved

Date -format= YYYY-MM-DD HH: MM :ss Spring.jackson. time-zone=Asia/ShanghaiCopy the code

2. There have been some problems and bugs in JDK handling daylight saving Time (especially China’s daylight saving Time). The corresponding JDK version at that time is1.8.0 comes with _2xxThe previous version had a problem formatting the date, but the later version seems to have a problem. Here I provide version information for reference only, if there is a similar case to upgrade the JDK version to the latest bar, generally there will be no problem.

3. Set the application’s timezone.setdefault (timezone.getDefault ().gettimezone (“GMT+8”));

4. Alternatively, add the startup parameter -duser. timezone=GMT+8