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

Home -> Community -> Usenet -> c.d.o.server -> Re: Trivia question re TO_DATE(SYSDATE)

Re: Trivia question re TO_DATE(SYSDATE)

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 10 Oct 1999 17:07:51 GMT
Message-ID: <7tqh57$i7g$1@news.seed.net.tw>

Gary McFarling <gmcfarli_at_itind.com> wrote in message news:7tluo0$kdg$1_at_republic.btigate.com...
> To_date() is a lovely way of parsing the date out of a dateTime data field
> of system object like sysdate. Another is Trunc() the two of these
together
> are designed and work quite well at killing, or making light of, the time
> that is inherently part of all Oracle dates. I guess I would be quite
> surprised if time survived the To_date() method.

Not true!

to_date() and trunc() are not the same. The expression to_date(sysdate) does NOT always clear out the time part, but trunc(sysdate) does do.

SQL> alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS';

Session altered.

SQL> select to_date(sysdate) from dual;

TO_DATE(SYSDATE)



1999/10/10 21:28:47

SQL> select trunc(sysdate) from dual;

TRUNC(SYSDATE)



1999/10/10 00:00:00 Received on Sun Oct 10 1999 - 12:07:51 CDT

Original text of this message

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