Date formatted using the potential problem of YYYY-MM-dd

 

 

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

YYYYShi 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 yyyythe time, it was 2019.

Instructions

 

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

Guess you like

Origin www.cnblogs.com/liangsonghua/p/www_liangsonghua_com_5.html