Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Date format in Oracle8
Bashar Ahmed Amin wrote
> How to change the default date format in Oracle8
> from DD-MM-YY to DD-MM-YYYY??
You can do it somewhere in you init.ora. However, if you plan not to explicitly specify the date format in your to_date statements, then it is better to always issue an alter session:
alter session set NLS_DATE_FORMAT='DD-MM-YYYY'
I doubt that your current format is DD-MM-YY. More likely it is DD-MON-YY or DD-MON-RR. And just since you ask this, I really have to urge you to read the manuals on date issues. Like the RR, RRRR, CC, HH and HH24 date formats and the trunc() function. And like what happens if you set the data format to DD-MM-YYYY but supply only tow digits for the date. Please try:
alter session set NLS_DATE_FORMAT='DD-MON-YYYY'
select to_date('01-JAN-99')
from dual;
and
select to_date('01-JAN-00')
from dual;
Also note that Oracle *always* stores four digits for the year, and also *always* stores a time-part, which could be 0:00:00.
Arjan. Received on Sun May 09 1999 - 14:40:13 CDT
![]() |
![]() |