COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sg on 16 Jul 2009 06:16:21 AM

Title: Date conversion Function
Post by: sg on 16 Jul 2009 06:16:21 AM
Hi All,

I have a dat item in which i have given the expression as current_date.

The current date displays in the format Jul 16,2009 .

Now i want to format the date to 20090716

I tried using the convert function and other SQL functions. But it does not work. It throws error as not supported because it is MDX.

Please let me know what is the exact expression to be used for conversion.

Thank you very much for the help.

Thanks,
Sg

Title: Re: Date conversion Function
Post by: Sridevi on 16 Jul 2009 07:53:02 AM
Try this...

in the data time expressino code as cast_date(current_Date). then in the dataformat of that data item select the type to be date and in the pattern as yyyymmdd
Title: Re: Date conversion Function
Post by: Sridevi on 16 Jul 2009 07:56:34 AM
Sorry the patter should be yyyyMMdd. you need not even cast the curren_date data item.

Thanks,
Sridevi
Title: Re: Date conversion Function
Post by: sg on 16 Jul 2009 09:05:53 AM
Thank you for the reply. But this doesn't work. I tried doing the same.

My requirement is i want to convert the date in another format.
For example, i take a data item and give the expression as current_date
it gives, jul 16, 2009.

Now i want to convert to any other format. here convert or cast function does not work beacuse it is an MDX. The source is SSAS cube.
Let me know if you want more info.



Thanks,
sg
Title: Re: Date conversion Function
Post by: redmist on 16 Jul 2009 11:38:54 AM
you have to modify the Data Format of that data item

Select
Date Style      : Medium
Date Separator: /
Dislplay Years  : Yes
Dsiplay Months: Two Digits
Dsiplay Days   : Two Digits