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.
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.