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 math....

Re: Time math....

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Mon, 11 Jan 1999 20:46:32 GMT
Message-ID: <369b60ae.10672816@inet16.us.oracle.com>


On Fri, 08 Jan 1999 08:41:53 -0800, gary_at_mindex.com wrote:

>Hello,I am trying to add a date/time field and an integer value of seconds
>and cannot get a precise result.Anyone doing this? Or know how?Any help
>is appreciated!Thanks,Gary Dixon
>

In Oracle date math, adding one is actually adding one day. So if you want to add 1 sec then you must add this as a fraction of a day. Adding 1 second would look like ...

date + 1/84600

eg.

SQL> select to_char( sysdate, 'HH24:MI:SS' ) "Time",

  2  to_char( sysdate+1/84600, 'HH24:MI:SS' ) "Time + 1 Sec",
  3  to_char( sysdate+1/1440, 'HH24:MI:SS' ) "Time + 1 Min",
  4  to_char( sysdate+1/24, 'HH24:MI:SS' ) "Time + 1 Hr"
  5 from dual
  6 /

Time Time + 1 Sec Time + 1 Min Time + 1 Hr -------- ------------ ------------ ------------ 15:41:09 15:41:10 15:42:09 16:41:09

Hope this helps.

chris.

>
>
>*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Jan 11 1999 - 14:46:32 CST

Original text of this message

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