Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Date Timestamp Functions
 

Using the YY Format

If you use the YYYY format but only supply a two-digit date, the date is interpreted using the YY format. In this case, the century for your year is assumed to be the same as the present century currently set on your database server. which means, first two digits of your supplied year are set to the first two digits of the present year. SQL> SELECT   2    TO_CHAR(TO_DATE('04-JUL-25', 'DD-MON-YY'), 'DD-MON-YYYY'),   3    TO_CHAR(TO_DATE('04-JUL-85', 'DD-MON-YY'), 'DD-MON-YYYY')   4  FROM dual; TO_CHAR(TO_ TO_CHAR(TO_ ----------- ----------- 04-JUL-2025 04-JUL-2085 SQL>