Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Time within a number of minutes of a target time

Re: Time within a number of minutes of a target time

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 17 Feb 2006 08:14:49 -0800
Message-ID: <1140192889.895258.18440@z14g2000cwz.googlegroups.com>


There is probably a better way but this came to mind:

Calculate the time of day in seconds and figure out the high and low values for the range.
I use the current time minus and plus 5 minutes for the end points

UT1 > l
  1 select

  2    to_char(sysdate,'SSSSS') as SecFrMidnight
  3   ,to_char(sysdate - 5/1440,'SSSSS') as LowRange
  4   ,to_char(sysdate + 5/1440,'SSSSS') as HighRange
  5* from sys.dual
UT1 > /

SECFR LOWRA HIGHR
----- ----- -----

39921 39621 40221

UT1 > get t10 -- fld3 is a date column in a simple table   1 select to_char(fld3,'SSSSS') from marktest   2 where to_number(to_char(fld3,'SSSSS')) >= 39425   3* and to_number(to_char(fld3,'SSSSS')) <= 40025 UT1 > /

TO_CH



39898

Where the row returned is a row I just inserted using sysdate to get a row that should meet the test. Another test where I subtracted 3 days from the sysdate before extracting the time also turned up a hit so if you did mean that the date of the month, month, and year do not matter as only the time matters then this will work.

HTH -- Mark D Powell -- Received on Fri Feb 17 2006 - 10:14:49 CST

Original text of this message

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