Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Date Format
A copy of this was sent to bcrowell_at_sbmct.com
(if that email address didn't require changing)
On Fri, 12 Feb 1999 19:53:30 GMT, you wrote:
>I am trying to retreive data from my oracle database , based on a time. For
>example the following code will retreive the data if it is 11:00 or later.
>What i am trying to do is if i have some data that i know happend at 11:13am
>and i did NOT want my seql to pick it up , How would i format this ??
>
>Thanks for the help
>Bruce
>
>
>
>
>CONNECT INTERNAL/password_at_orapcbk;
>
>Select queapplhist.returncd, queapplhist.applnbr, queapplhist.checkpoint,
>queapplhist.startdatetime
> from queapplhist
> where queapplhist.returncd <> '0'
>
> and queapplhist.startdatetime > (to_date(sysdate)+11/24);
>
>
because to_date(sysdate) = sysdate. you want trunc(sysdate)
Consider:
SQL> alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss'; Session altered.
SQL> select sysdate from dual;
SYSDATE
SQL> select to_date(sysdate)+11/24 from dual;
TO_DATE(SYSDATE)+11/
see -- thats 11 hours after right now
SQL> select trunc(sysdate)+11/24 from dual;
TRUNC(SYSDATE)+11/24
and thats 11 oclock today...
>
>
>EXIT;
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Feb 12 1999 - 14:49:26 CST