Hacker Newsnew | past | comments | ask | show | jobs | submitlogin



>WWE 2K20, a professional wrestling video game, also stopped working at midnight on 1 January 2020. Within 24 hours, the game’s developers, 2K, issued a downloadable fix.

An almost poetic irony


I had heard that that was actually an ISO year issue. For example 2019-12-30 becomes 2020-12-30 if you mistakenly use IYYY-MM-DD instead of YYYY-MM-DD (which kind of makes sense IYYY shows up first in documentation).


Haha I should have known it would be even simpler than trying to estimate which date is reasonable. Interestingly Oracle just treats all XX as 20XX from my brief testing when doing to_date with 'YYMMDD' as the format.


This is how it works in Oracle:

If you use the TO_DATE function with the YY datetime format element, then the year returned always has the same first 2 digits as the current year. If you use the RR datetime format element instead, then the century of the return value varies according to the specified two-digit year and the last two digits of the current year.

That is:

If the specified two-digit year is 00 to 49, then:

* If the last two digits of the current year are 00 to 49, then the returned year has the same first two digits as the current year.

* If the last two digits of the current year are 50 to 99, then the first 2 digits of the returned year are 1 greater than the first 2 digits of the current year.

If the specified two-digit year is 50 to 99, then:

* If the last two digits of the current year are 00 to 49, then the first 2 digits of the returned year are 1 less than the first 2 digits of the current year.

* If the last two digits of the current year are 50 to 99, then the returned year has the same first two digits as the current year.


Interesting I've never had to dig into that, started working well after Y2K and the company I work at, as far as I see, properly converted any legacy XX years ages ago.

Is the switch date for RR fixed? Seems like there will be some weird breakage around 2050 as random places that have been skating by on using RR for old 2 digit years will be in trouble.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: