Yesterday saw this on the use YYYY-MM-dd and the emergence of post Bug (v2ex.com/t/633650) v station on very interesting, so get over to share.
In any programming language, for a time, and other digital data, there are usually many similar this all OK, a specific time, specific cases of environmental problems. The root cause of this problem or are we to define the details of the various data structures do not pay attention in the beginning, all began with the understanding of "unforgettable" from the problems after each use.
After yesterday, no matter whether you have experienced this Bug, or not experienced readers would like to see this article for the details on the dessert can be avoided in the future because of this detail and make mistakes.
Here's a look at the performance and the cause of this problem it:
Performance issues
The reason BUG
YYYY
Shi week-based-year
, said: year in which the day of the week belongs to the week beginning Sunday from the end of Saturday, the week long New Year's Eve, then this week even into the next year. So December 31, 2019 In this day of expression had been in 2020 a.
And when yyyy
the time, it was 2019.
Instructions
- https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns
- https://nakedsecurity.sophos.com/2019/12/23/serious-security-the-decade-ending-y2k-bug-that-wasnt/
BLOG Address: www.liangsonghua.com
Focus on micro-channel public number: preserved egg blackboard, get more exciting!
Public No. Description: sharing technology insights to work in Jingdong, as well as JAVA technology and industry best practices, most of them are pragmatic, can understand, reproducible