IBM Support

How to convert a Unix timestamp to a date in Cognos 10

Troubleshooting


Problem

How can I convert a Unix timestamp to a date in Cognos 10

Resolving The Problem

This can be achieved by using a Query Calculation with the following Expression Definition:

_add_days(1970-01-01, (UnixTimeStamp / 60 / 60 / 24))

For example:

_add_days(1970-01-01, (1222128000 / 60 / 60 / 24))

will return September 23rd 2008.

It is also possible to supply a negative number to return dates prior to 1970:

_add_days(1970-01-01, (-108086400 / 60 / 60 / 24))

will return July 30th 1966.


[{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Cognos Administration","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"10.2;10.2.1;10.2.2","Edition":"Edition Independent","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

1041358

Document Information

Modified date:
15 June 2018

UID

swg21343316