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: Milliseconds Timestamps

Re: Milliseconds Timestamps

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 25 Jan 2006 10:46:19 -0800
Message-ID: <1138214779.370784.26360@g49g2000cwa.googlegroups.com>


I did not see a what I considered to be a clear example of how to do this but looking over the material I came up with this. Warning I am math challenged so a "stupid" error is likely to exist but I think the idea itself will work.

O9I1 > l
  1 select current_timestamp - to_timestamp(sysdate - 1) as Base,   2 extract (Day From (current_timestamp - to_timestamp(sysdate - 1))) *
  3 86400000 +
  4 extract (Hour From (current_timestamp - to_timestamp(sysdate - 1))) *
  5 3600000 +
  6 extract (Minute From (current_timestamp - to_timestamp(sysdate - 1))) *
  7 60000 +
  8 + extract (Second From (current_timestamp - to_timestamp(sysdate - 1)))*
  9 1000 as Milliseconds
 10* from sys.dual
O9I1 > /

BASE



MILLISECONDS

+000000001 13:16:40.926294

   134200926

As soon as I posted this I noticed that now minus a day should be 24 hours give or take a fractional component however the to_timestamp of sysdate - 1 defaults the hours to 12 AM so I think this is right. There is probably a better method.

HTH -- Mark D Powell -- Received on Wed Jan 25 2006 - 12:46:19 CST

Original text of this message

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