This content has been marked as final. Show 2 replies
If you are converting an input string to a date and that string has 2 digit years (shame on whoever did that), use RR instead of YY.
'YY' means the first 2 digits will be the same as the first 2 digits of the current year. If you run that code in 2012, then '99' will be taken as short for 2099.
If you want '99' to mean 1999, then use 'RR' instead of 'YY'.
This shows one of the many reasons why storing date information in a VARCHAR2 column is such a bad idea. If you use a DATE column, the year is always indicated precisely.
TO_CHAR ( TO_DATE ( builddate , 'DD-MM-RR' -- Not 'DD-MM-YY' ) , 'YYYY-MM-DD' )