COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: dud987 on 06 Apr 2017 11:13:03 AM

Title: Struggling to get data using timestamp in Cognos
Post by: dud987 on 06 Apr 2017 11:13:03 AM
To friends...

I have two questions

1. I have a field that contains date and time. I am trying to get data for the past 12 hours and I used this function but still struggling to get data for the past 20 hours

cast([Date/Time],hours) between _add_hours( current_timestamp,-20) and (current_timestamp)


2. If at all I have to get data from say 10.30 am yesteday to current time(say 12:00 pm, today) what function should i use ...

Please let me know, if further information is required

Thanks in advance..
Title: Re: Struggling to get data using timestamp in Cognos
Post by: New_Guy on 06 Apr 2017 01:08:27 PM
Hi,
Try this   _add_hours ([Date/Time], 20) and let us know if it works or not.
Good luck
New guy
Title: Re: Struggling to get data using timestamp in Cognos
Post by: dud987 on 06 Apr 2017 02:10:51 PM
Thanks, New Guy for the response but didn't work out...

I found a way though

[Date/Time] between (_add_days(current_date,-1) || '11:30:00 AM') and (current_date || '12:00:00 PM')

Thanks..