Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Comparing dates
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
![]() |
![]() |