COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Framework Manager => Topic started by: cognos.monster on 21 Sep 2011 03:00:17 AM

Title: How to Convert EPOCH (Unix Time) to Standard Time
Post by: cognos.monster on 21 Sep 2011 03:00:17 AM
Hi,

my source generates EPOCH time, how do i convert it to a more human readable format?  I want to do this in framework manager so i could extract the day, month, hour, minutes, secs, out of it .

has anyone done this?

Thanks!
Title: Re: How to Convert EPOCH (Unix Time) to Standard Time
Post by: the6campbells on 17 Jan 2012 11:18:24 PM
assuming you meant the UNIX epoch

your RDBMS may provide a function specifically to do this

from an ISO-SQL perspective as supported in a query/data item you could define this expression which returns a timestamp with timezone adjusted by the interval number of seconds represented by the epoch. Then you can format it as that type and so on.

1970-01-01 00:00:00.000000000+00:00 + cast(  <numeric-value>  , interval second)
Title: Re: How to Convert EPOCH (Unix Time) to Standard Time
Post by: tjohnson3050 on 18 Jan 2012 08:04:03 AM
You could try using a date dimension that accounts for unix time:

Here is link to a script that will create a date dimension with a field for the beginning and ending Unix Time for every day in the date dimension.  You can join to your unix time field in the source by doing >= unix begin time and <= unix end time, then do all kinds of date reporting.  The script is for SQL Server, so if you have a different data source, you can use it, but you could reverse engineer the logic for it.

http://www.cognoise.com/community/index.php?topic=18304.0