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: converting timestamp in milliseconds to date or vice-versa in oracle

Re: converting timestamp in milliseconds to date or vice-versa in oracle

From: <ameyas7_at_yahoo.com>
Date: 4 Feb 2005 09:20:39 -0800
Message-ID: <1107537639.394937.5780@l41g2000cwc.googlegroups.com>

Hi Rauf,

i got it ... just in case if you are interested.

select TO_DATE('1970-01-01', 'YYYY-MM-DD')+ max(numtodsinterval(to_number(timestamp_col)/1000,'SECOND')) from your_table;

where timestamp_col is the column name which stores the timestamp and your_table is the required table.

> On a side note... why use currentTimeMillis at all and store in
> varchar2 field?... why not use sysdate and store it properly in the
> Date column?

the timestamp is used for auditing purpose. it stores the timestamp precisely, which is required at some of the places in the system and the system is already in place so it would not be advisable to change the type now ;)

cheers
amey Received on Fri Feb 04 2005 - 11:20:39 CST

Original text of this message

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