OnDemand Users Group

Support Forums => CMOD for z/OS Server => Topic started by: LWagner on December 07, 2010, 10:34:30 PM

Title: converting system log timestamp integer field
Post by: LWagner on December 07, 2010, 10:34:30 PM
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
Title: Re: converting system log timestamp integer field
Post by: ewirtz on December 08, 2010, 07:40:38 AM
you can get p.e. the date with the following SQL:
SELECT DATE('01.01.1970')  + (<integer>/86400) DAYS FROM SYSIBM.SYSDUMMY1;
Title: Re: converting system log timestamp integer field
Post by: Justin Derrick on December 08, 2010, 01:47:26 PM
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.