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 > DB2 Epoch function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-07, 11:01
PKPChuck PKPChuck is offline
Registered User
 
Join Date: Sep 2006
Location: Columbus, OH
Posts: 64
DB2 Epoch function

DB2 8.2
AIX 5.2


I've got a trigger which insert a current timestamp in DB2 Timestamp format but I want to have a trigger which inserts current EPOCH time. I haven't been able to find a db2 function for it, so was looking for the least hack way to do it.

Thanks,

Charlie
Reply With Quote
  #2 (permalink)  
Old 11-26-07, 11:39
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
DAYS or JULIAN_DATE functions.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 11-26-07, 11:39
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
See if this helps:
Code:
db2 values bigint(days(current date) - days('1970-01-01'))*bigint(86400) 
+ midnight_seconds(current_timestamp - current_timezone)
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