COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: RP on 12 Sep 2007 09:19:53 AM

Title: convert number to Date
Post by: RP on 12 Sep 2007 09:19:53 AM
Hi all,

I have a question, pl any one can help me. My date field is oracle database ie. number(30122007) and now I want to convert to date (YYYY-Mon) in reportstudio, pl can any one tell me how to convert number to date.

Thanks
RP
Title: Re: convert number to Date
Post by: MDXpressor on 12 Sep 2007 09:47:34 AM
Use the Oracle to_date function.

to_date([Date],'YYYY-MMM-DD')

The string 'YYYY-MMM-DD' can be arranged to match the output you are seeking. 

At times I have had to convert to a char first (to_date(to_char([Date]), 'YYYY-MMM-DD')
Title: Re: convert number to Date
Post by: raja.chanda on 17 Sep 2007 08:12:34 AM
Quote from: RP on 12 Sep 2007 09:19:53 AM
Hi all,

I have a question, pl any one can help me. My date field is oracle database ie. number(30122007) and now I want to convert to date (YYYY-Mon) in reportstudio, pl can any one tell me how to convert number to date.

Thanks
RP

to_char(to_date(to_char([date]),'DDMMYYYY'),'YYYY-Mon')
or
to_char(to_date([date],'DDMMYYYY'),'YYYY-Mon')