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
Try this:
select to_date('10:20:32','hh:mi:ss') -
to_date('10:25:29', 'hh:mi:ss')
from dual
/
Viktor
--- Nguyen, David M [EMAIL PROTECTED] wrote:
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
Jack,
How about substracting a system date with a database replication date to get
difference of time? Can you please give me a specific command?
SQL select to_char(sysdate, 'Dy Mon Dd HH24:MI:SS ') from dual;
TO_CHAR(SYSDATE,'DYMONDD
Mon Apr 01 11:08:00 2002
David,
SysDate is a function and can be referenced in any SQL statement. So you
could do the following if you want seconds between the two, or leave off
some or all of the trailing multiplicands to get fractional minutes, hours
or days.
Select ( SysDate - Next_Date ) * 24 * 60 * 60
From
Here is a script I recently made to help me understand how the date worked.
REM Elapsed Time
define start_time = '03-25-02 11:17:12'
define stop_time = '03-27-02 12:36:30'
define date_fmt = 'mm-dd-yy hh24:mi:ss'
select trunc(to_date('stop_time', 'date_fmt')
- to_date('start_time',
Nguyen, David M wrote:
Jack,
How about substracting a system date with a database replication date to get
difference of time? Can you please give me a specific command?
SQL select to_char(sysdate, 'Dy Mon Dd HH24:MI:SS ') from dual;
TO_CHAR(SYSDATE,'DYMONDD
It works. Thank you so much, Jack.
David
-Original Message-
Sent: Monday, April 01, 2002 10:38 AM
To: Multiple recipients of list ORACLE-L
David,
Select (DateTime1 - DateTime2) * 24 * 60 * 60
From Dual
;
Oracle date arithmetic results are in fractional days, so the above gets you
Thanks for your advices, Stephane.
David
-Original Message-
Sent: Monday, April 01, 2002 12:19 PM
To: Multiple recipients of list ORACLE-L
Nguyen, David M wrote:
Jack,
How about substracting a system date with a database replication date to
get
difference of time? Can you