Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtract 35 minutes from sysdate 2

Status
Not open for further replies.

missmis44

MIS
Sep 11, 2002
22
US
I have the below statement in which I want return all rows that have a releastime between ((sysdate-35 minutes) and sysdate). How would I accomplish this?

SELECT BOOK_ID, NAME_ID, TO_CHAR(RELEASTIME, 'DDMMYYYY') "RELEASE_DATE", TO_CHAR(RELEASTIME, 'HH:MI:SS AM') "RELEASE_TIME",
TO_CHAR(SYSDATE, 'DD:MM:YYYY:HH:MI:SS AM')
FROM JRELEASE
WHERE TO_CHAR(RELEASTIME, 'DD:MM:YYYY:HH:MI:SS AM') BETWEEN (TO_CHAR(SYSDATE, 'DD:MM:YYYY:HH:MI:SS AM') - 35MI AND
TO_CHAR(SYSDATE, 'DD:MM:YYYY:HH:MI:SS AM');
 
Since every day is consider as the number 1, to find the number of minutes in a day take 1 day * 24 Hours * 60 Mins in an hour to come up with 1440 minutes = 1 day. Based on that, if you want to subtract 35 minutes from a SYSDATE, I **THINK** you can use (SYSDATE - (35/1440)) to get 35 minutes ago...

Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Exactly Terry![/code]
SQL> select to_char(sysdate,'mm/dd/yy hh24:mi:ss') now,
2 to_char((SYSDATE - (35/1440)),'mm/dd/yy hh24:mi:ss') minus35
3 from dual;

NOW MINUS35
----------------- -----------------
06/19/03 15:18:41 06/19/03 14:43:41
SQL>
[/code]


Beware of false knowledge; it is more dangerous than ignorance. ~George Bernard Shaw
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
 
< bows >

Thanks BJ...

Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top