Solved

oracle query with substracting 60 minutes from time

Posted on 2014-01-29
2
390 Views
Last Modified: 2014-01-29
select current_date,
       to_char(current_date,'HH24:MI') currenttime,
       schedule_start_time,
         to_char(schedule_start_time,'HH24:MI') starttime,
       schedule_end_time,
         to_char(schedule_end_time,'HH24:MI') endtime,
           case when to_char(current_date,'HH24:MI')
             between to_char(schedule_start_time,'HH24:MI') and to_char(schedule_end_time,'HH24:MI')
             then 'in between'
             else 'not in between'
           end between_times
  from drives@qdon d,sites s
 where d.location_id = s.lt_location_id
   and drive_id = 'DRV5543050'
   and drive_date = trunc(sysdate);


CURRENT_DATE,CURRENTTIME,SCHEDULE_START_TIME,STARTTIME,SCHEDULE_END_TIME,ENDTIME,BETWEEN_TIMES

1/29/2014 11:31:10 AM,11:31,1/29/2014 11:30:00 AM,11:30,1/29/2014 7:00:00 PM,19:00,in between

I want to substract 60 minutes from both

 schedule_start_time and to_char(schedule_start_time,'HH24:MI') starttime

Help is appreciated
0
Comment
Question by:anumoses
2 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39818395
many ways to subtract 1 hour.

Try:
date_column-(60/1440)
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39818421
thanks that worked
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question