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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to calculate time using SQL

RE: How to calculate time using SQL

From: Jack C. Applewhite <japplewhite_at_inetprofit.com>
Date: Mon, 01 Apr 2002 08:38:28 -0800
Message-ID: <F001.00437E51.20020401083828@fatcity.com>


David,

Select (DateTime1 - DateTime2) * 24 * 60 * 60
>From Dual

;

Oracle date arithmetic results are in fractional days, so the above gets you the number of seconds between two Date datatype arguments. Of course you can go ahead and multiply 24*60*60 to get Seconds/Day, but I prefer to leave it that way so it's more obvious what my intent is.

Jack



Jack C. Applewhite
Database Administrator/Developer
OCP Oracle8 DBA
iNetProfit, Inc.
Austin, Texas
www.iNetProfit.com
japplewhite_at_inetprofit.com
(512)327-9068

-----Original Message-----
David M
Sent: Monday, April 01, 2002 9:48 AM
To: Multiple recipients of list ORACLE-L

Is it possible to calculate seconds using SQL?

For example, I'd like to subtract these two time to get difference in seconds:

10:20:32 - 10:25:29

Thanks,
David

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jack C. Applewhite
  INET: japplewhite_at_inetprofit.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Apr 01 2002 - 10:38:28 CST

Original text of this message

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