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: Comparing dates

Re: Comparing dates

From: Vrajesh Patel <vrajesh.patel_at_mci.com>
Date: Mon, 03 May 1999 19:08:16 GMT
Message-ID: <372DF418.5364115E@mci.com>


Oracle uses default format as dd-mon-yy. Use trunc(to_date('01-MAY-1999','DD-MON-YYYY')) will work. Or change NLS_DATE_FORMAT to use default format as dd-mm-yyyy.

Hope will help you.

Thanks,

Vrajesh Patel.
Oracle DBA.

Sam Jordan wrote:

> Hi
>
> Can anyone explain this:
>
> SQL> select * from history where key = 21120;
>
> KEY EVENT USR PRODUCT EVENTDATE ENTRYDATE
> ---------- ---------- ---------- ---------- --------- ---------
> 21120 4852 11351 4844 01-MAY-99 03-MAY-99
>
> SQL> select count(*) from history where trunc(eventdate) =
> trunc(to_date('01-05-1999','DD-MM-YYYY'));
>
> COUNT(*)
> ----------
> 0
>
> I thought that trunc() without fmt argument returns the current
> day with time set to midnight? Why then does the above comparison
> not find the row first printed out? How should this comparison
> be done? What's the usual way of finding out if one date's day
> is equal to the other date's day?
>
> bye
> --
> Sam Jordan
Received on Mon May 03 1999 - 14:08:16 CDT

Original text of this message

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