The ‘DD-Mon-YY’ format always specifies the two digit year as the current century. So when we specify ’25-May-08’ then the year is translate as 2008.
The ‘DD-Mon-RR’ format is the default format in ORACLE databases. Here the two digit year will be translated as below.
| If the specified two-digit year is: | ||
00-49 | 50-99 | ||
If two digits of the current year are: | 00-49 | The return date is in the current century | The return date is in the century before the current one |
50-99 | The return date is in the century after the current one | The return date is in the current century |
Example:
CREATE TABLE test_date(
colA DATE,
colB NUMBER);
INSERT INTO test_date
VALUES (TO_DATE('22-Dec-98','DD-Mon-YY'),4);
COMMIT;
INSERT INTO test_date
VALUES (TO_DATE('22-Dec-98','DD-Mon-RR'),5);
COMMIT;
So when we use formats for date in ORACLE databases we need to make sure that we are using the correct format.
super :)
ReplyDelete