Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I insert date/time into a ORACLE date field?????? - new to ORACLE
In article <01bc0814$e0758ea0$2e6893cf_at_default>,
Vijay Vardhineni <vardhineni_at_worldnet.att.net> wrote:
>you need to use TO_DATE function in your insert statement. Here is an
>example for inserting '1-JAN-97 12:45:43' in your table.
>
>insert into fi_test(create_date) values (to_date('1-JAN-97 12:45:43',
>'DD-MON-YY HH:MI:SS'));
Don't let the system assume the century. This will get you into trouble.
It would be better to use...
values (to_date('01-JAN-1997 23:59:59','DD-MON-YYYY HH24:MI:SS'));
Note the 2-digit day, 4-digit year and HH24 for 24-hour time.
Also this will work:
values (to_date(12312000 12:34:56','MMDDYYYY HH24:MI:SS'));
Steve Cosner Received on Wed Jan 22 1997 - 00:00:00 CST