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: SQL COMMAND

Re: SQL COMMAND

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Tue, 17 Dec 2002 09:35:55 -0800
Message-ID: <3DFF607B.EDD45D43@exesolutions.com>


Dominique PREVOT wrote:

> Hi,
> Does anyone know if there is a SQL command that convert a date-time
> value to a date value ?
>
> For instance,
>
> select * from table where (TO_DATE(CreationDate) < 2002/12/01);
>
> (where CreationDate is a date-time field (yyyy/mm/dd:hh:mm:ss:lll))
>
> Thanks for help,
> Dominique

All dates in Oracle contain the time. There is no alternative.

If you want to display only the date use TO_CHAR(datevalue, 'YYYY/MM/DD') If you want to make all date-times for the same calendar day comparable:

TRUNC(datevalue)

which converts the hours, minutes, and seconds to 00:00:00

Daniel Morgan
http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp Received on Tue Dec 17 2002 - 11:35:55 CST

Original text of this message

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