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

Home -> Community -> Usenet -> c.d.o.server -> Re: calculation with's date

Re: calculation with's date

From: David Fitzjarrell <oratune_at_msn.com>
Date: 20 Sep 2001 14:48:39 -0700
Message-ID: <32d39fb1.0109201348.1e9666b1@posting.google.com>


Incorrect. Subtracting two date fields yields days and the fraction of a day, NOT <date_in_days_since_?>.<time_in_seconds_since_midnite> as misstated:

SQL> select date2 - date1
  2 from mytable;

DATE2-DATE1


 .000358796                  <------ Fraction of a day


Therefore to get seconds one would:

SQL> select (date2 - date1)*86400
  2 from mytable;

(DATE2-DATE1)*86400


                 31          <------ Seconds between the two date
values

David Fitzjarrell
Oracle Certified DBA

"Scott Mattes" <ScottMattes_at_yahoo.com> wrote in message news:<aWnq7.600$z61.334614_at_news1.news.adelphia.net>...
> Oracle's date type is
> <date_in_days_since_?>.<time_in_seconds_since_midnite>, so after the
> subtraction you will still have days.seconds
>
> You can figure out how many seconds the days represent by doing
> trunc(date_field) * 3600 * 24, I off the top of my head I don't know how to
> add in the original seconds.
>
> It will probably come to me right after I click on the next newsgroup
> though.
>
> "Thomas" <thomas.hiller_at_warema.de> wrote in message
> news:6e366956.0109200629.53a8163a_at_posting.google.com...
> > Hello,
> >
> > is it possible to substract two date-format columns and get the
> > correct amount of seconds
> >
> > regards
> > Thomas
Received on Thu Sep 20 2001 - 16:48:39 CDT

Original text of this message

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