Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Time math....
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
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.
![]() |
![]() |