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: SQL: Getting the difference of two date fields in seconds.

Re: SQL: Getting the difference of two date fields in seconds.

From: Andy Hardy <aph_at_ahardy.demon.co.uk>
Date: Thu, 15 Jul 1999 22:49:02 +0100
Message-ID: <bUeUnEAOdlj3EwOm@ahardy.demon.co.uk>


In article <7mljdd$lt7$1_at_news.powerisp.com>, Jerel Thompson <jthompson_at_poweruser.com> writes
>Hi,
>
> I have two date fields. A start date and an end date. How do I find
>the difference of the two dates in seconds in SQL? I am using Oracle 8.0
>for linux.
>
>

The difference between two dates is given in complete days i.e. 1 = 1 day. So to get seconds you multiply the result by (24 * 60 * 60) e.g .5 days = .5 * (24 * 60 * 60) seconds.

e.g.

SELECT (end_date - start_date) * (24 * 60 * 60) FROM my_table;

Andy

--
Andy Hardy. PGP key available on request


Received on Thu Jul 15 1999 - 16:49:02 CDT

Original text of this message

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