It's all about the answers!

Ask a question

Determine the difference between two datetime values in Cognos RRDI Reporting


Sanket Baxi (1112) | asked Aug 18 '14, 8:31 a.m.
edited Aug 19 '14, 4:52 p.m. by Stephanie Taylor (24115)
We have two timestamp attributes in an RTC work item. Using the Cognos RRDI Report Studio, how can we determine the difference between the datetime values fetched from these fields? The resulting answer should be in hours.

Example:
Attribute 1: 18 Aug 2014, 01:00:00 PM
Attribute 2: 19 Aug 2014, 02:00:00 PM

Result: 25 hours

Please let us know how to achieve this.

One answer



permanent link
Francesco Chiossi (5.7k1719) | answered Aug 18 '14, 9:03 a.m.
edited Aug 18 '14, 9:18 a.m.
Hello Sanket,

a solution to your request is described at this link:
http://www.cognoise.com/community/index.php/topic,7912.msg25908.html#msg25908
(extract(hour,[Data Item2])*60+extract(minute,[Data Item2]))-(extract(hour,[Data Item1])*60+extract(minute,[Data Item1]))+_days_between([Data Item1],[Data Item2])*1440

that is in minutes, to get it in hours it could be modified to something like this
extract(hour,[Data Item2])-extract(hour,[Data Item1])+_days_between([Data Item2],[Data Item1])*24

Best Regards,

Francesco Chiossi

Your answer


Register or to post your answer.