Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie question date vs datetime fields?

Re: newbie question date vs datetime fields?

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Fri, 20 Nov 1998 10:50:10 +0100
Message-ID: <733e2q$g09$1@newton.a2000.nl>


James J. Schmidt wrote
>ccyymmddhhmiss format.

Ehhh, a bit off-topic, but note that CC in Oracle is the century, like 20 for 1998 and 21 for 2001! I've read somewhere at http://www.oracle.com that for 2000 the CC is not even calculated correct. So, simply don't use it in date formats.

Robert, if you want to store the date without the time, use

    set my_date = trunc( sysdate )

which will set the time to 00:00:00. Furthermore, when comparing two date fields just for the date while you're not sure that the time part is 00:00:00, use

    where trunc( date_1 ) = trunc( date_2 )

To see what has been stored, tell Oracle to show it all. If you don't tell Oracle how to print it, it uses the default format. This is most likely DD-MON-YY, telling Oracle to forget about the time part when converting the date into something readable:

    select sysdate
    , to_char( sysdate, 'DD-MON-YYYY HH24:MI:SS )     from dual;

Dates are too important nowadays, so also check out the RR and RRRR formats in your help!

Arjan. Received on Fri Nov 20 1998 - 03:50:10 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US