COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: igfortun on 12 Dec 2020 04:12:54 PM

Title: Converting text to date or number
Post by: igfortun on 12 Dec 2020 04:12:54 PM
Hi all, 
I am trying to create a new data item that converts text such as: "10:45:00 AM" to either a true date format, or numeric format. 
Thank you so much in advance,
Title: Re: Converting text to date or number
Post by: oscarca on 14 Dec 2020 02:47:19 AM
Hello,
Below statement will cast String to Time format:

cast('10:45:00' as time)

//Oscar
Title: Re: Converting text to date or number
Post by: igfortun on 14 Dec 2020 08:16:59 AM
But my data field has the words "AM" and "PM"
Title: Re: Converting text to date or number
Post by: oscarca on 14 Dec 2020 08:22:59 AM
It should work anyways cast('10:45:00 AM' as time)