If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > BigInt to TimeStamp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-16-11, 02:51
toengineer2003 toengineer2003 is offline
Registered User
 
Join Date: Nov 2011
Posts: 1
BigInt to TimeStamp

Hi,


We have a metadata repository table where the timestamp field is getting stored in BIGINT.

Below are the two such values that got created on Nov 16 2011 11:45 PM

1321465242047
1321465263973

How can I retrieve the timestamp from this field.

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-16-11, 04:23
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Are there any documentation for the metadata repository table?

I'm not sure, but this example gave near the created time.
Code:
------------------------------ Commands Entered ------------------------------
SELECT timestamp_col
     , TIMESTAMP('1970-01-01') + (timestamp_col * 0.001) SECONDS AS db2_timestamp
 FROM  (VALUES 1321465242047
             , 1321465263973 ) t(timestamp_col)
;
------------------------------------------------------------------------------

TIMESTAMP_COL        DB2_TIMESTAMP             
-------------------- --------------------------
       1321465242047 2011-11-16-17.40.42.047000
       1321465263973 2011-11-16-17.41.03.973000

  2 record(s) selected.

Last edited by tonkuma; 11-17-11 at 01:09. Reason: Replace whole expression to calculate db2_timestamp.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On