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: Q: Date/time arithmetics with Oracle Server

Re: Q: Date/time arithmetics with Oracle Server

From: <markp7832_at_my-deja.com>
Date: Fri, 25 Jun 1999 18:07:09 GMT
Message-ID: <7l0gg3$b59$1@nnrp1.deja.com>


In article <3773B16D.BC7465C2_at_xlink.net>,   Uwe Schneider <uwe.schneider_at_xlink.net> wrote:
> Hi experts,
>
> is there an easy way to add or subtract a number of seconds to/from
an
> Oracle date type such as
>
> ADD_SECONDS(date_val,-20)
>
> without using special packages???
>
> In my opinion the Oracle DATE type is quite strange.
>
> Best regards!
> --
> uwe.schneider_at_xlink.net
>

To answer your question:
UAT1> l
  1 select to_char(sysdate,'yyyymmdd hh24:mi:ss') now,   2 to_char(sysdate + ( 20 / 86400 ),'yyyymmdd hh24:mi:ss') "now+20sec"
  3* from sys.dual
UAT1> / NOW



now+20sec

19990625 13:59:22
19990625 13:59:42

Oracle performs addition and substraction to a date in units of days so there are 86400 seconds to a day hince hours, minutes, and seconds may be represented as a fraction of a day. There was a recent thread on calculating the difference in time between two days which you may want to hunt for. If you can not find it I would be glad to e-mail you the couple of queries/functions that users posted that I copied to study.

--
Mark D. Powell -- The only advice that counts is the advice that  you follow so follow your own advice --

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Fri Jun 25 1999 - 13:07:09 CDT

Original text of this message

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