converting system log timestamp integer field

Previous topic - Next topic

LWagner

The TIME_STAMP field is a 10-digit integer.  How do I convert this to a DATE or DATE/TIME format for use by SQL ?

Sample values:

1216828148
1216828197
1216828425
1216828431
1216828476

ewirtz

you can get p.e. the date with the following SQL:
SELECT DATE('01.01.1970')  + (<integer>/86400) DAYS FROM SYSIBM.SYSDUMMY1;

Justin Derrick

ewirtz has it right -- if you want the date in DB2's internal date format.

The 10 digit number you're seeing is the number of seconds since midnight on January 1st, 1970, exclusive of time zone information.  This is how time is measured on UNIX systems.

You can get the number of days since January 1st, 1970 by dividing by 86400 (the number of seconds in a day).  You can use this value (or the 10-digit integer) to feed into arsdate, and get a date and time, adjusted for your current time zone.

Hope this helps!

-JD.
Call:  +1-866-533-7742  or  eMail:  jd@justinderrick.com
IBM CMOD Wiki:  https://CMOD.wiki/
FREE IBM CMOD Webinars:  https://CMOD.Training/
IBM CMOD Professional Services: https://CMOD.cloud

Interests: #AIX #Linux #Multiplatforms #DB2 #TSM #SP #Performance #Security #Audits #Customizing #Availability #HA #DR