Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Milliseconds Timestamps
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
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