COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: CalebMF on 09 Apr 2013 05:07:23 PM

Title: Converting into a time stamp
Post by: CalebMF on 09 Apr 2013 05:07:23 PM
I am currently needing to find the time between two times (both are TimeStamps). The formula I am using is _Minutes_Between(Time2, Time1)
It works fine. The only problem is that Time2 has a default date of 1/1/1900. What I would like to do is create a time stamp by using the Time from Time2 and the date from another field Date1. So I wrote the following expression:
_make_timestamp (Cast([Date1] As Date), Cast([Time2] As Time))
It is currently giving me errors when I attempt to validate. Any easier way to acomplish this?
Thanks for help in advance.
Caleb
Title: Re: Converting into a time stamp
Post by: CalebMF on 11 Apr 2013 11:08:07 AM
Does anyone have any idea how to do this?
Title: Re: Converting into a time stamp
Post by: MFGF on 11 Apr 2013 11:54:34 AM
Hi,

Assuming one column has zero in the date part and real times in the time part, and the other has real dates in the date part and zero in the time part, you could in theory just mathematically add them together in a calculation to get a combined result with the dates and times.

The _make_timestamp function does not accept dates and times as arguments. All it will accept are integer values for year, month and day, and it defaults the time part to zero. This is why you are getting errors when passing in your date and time values.

Regards,

MF.