COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: priya@90 on 23 Aug 2018 06:11:49 AM

Title: Data time to date conversion in promt
Post by: priya@90 on 23 Aug 2018 06:11:49 AM
Hi,

How can convert date-time to dd/mm/yyyy format in my prompt, i have a date column which is having jan 01,2018 12:00:00Am, i wanted to use this as my prompt, it should show dd/mm/yyyy and based on user selection from date and to date (both are using same date column) i wanted to display report output. What i did but it's nor working, any guidance here.

1. i used this function to remove time format cast ([date_col],date) as data item1 this is working and
2. data item 2 used to_char (data item1,'dd/mm/yyyy') this is also working
3. used and display as data item2 in my from date and to_date prompts- this is also working
4. i am trying to restrict data (31/12/2020 data upto here) here  to show in prompt 4 years only and used  condition in my filter [data item2] >31/02/2016 ---this is not working
5. in my main query i have used [data item2] between ?from date? and ?to date?- this is also not working and taking long time to and i don't see any data now

Please any help here to resolve my issue and iam not getting where iam doing wrong here. Please correct me

thanks,
Priya
Title: Re: Data time to date conversion in promt
Post by: sdf on 23 Aug 2018 11:20:37 AM
Maybe because you are comparing items with different format. CHAR to DATE.
Why don't you try:
timestamp2date ( [date_col] )
Title: Re: Data time to date conversion in promt
Post by: Francis aka khayman on 28 Aug 2018 09:55:02 AM
use the data format properties to display the date as you wish. this way you do not have to convert the dates and can use date comparison on them easily.