dwokarrr
dwokarrr

Reputation: 1

Formatting date - Cognos Report Studio

In Cognos Reporting Studio I have a data item coming in that is a string representation of a date (varchar2). Example: 20230714

I need to display it in a column as a date in the format 'YYYY/MM/DD' without a timestamp. Example: 2023/07/14

I have used the cast function in the data item expression to convert it from a varchar to a date: cast([X].[Y].[Z], date)

The column is now displaying as a date in a 'Month Date, Year' format. Example: July 14, 2023

To change it to my desired format, I went to the column -> Properties -> Data -> Data Format. I believe there is then supposed to be a 'Date' type option, where I can then specify a pattern, but I only see 'Default' and 'Text'. Is this option no longer there?

So for now I have selected Text -> Pattern and applied 'yyyy/MM/dd'

However my output is still showing in the July 14, 2023 format. Any suggestions on how I can fix this? Is there maybe another function I can use in the expression itself?

Upvotes: 0

Views: 1541

Answers (1)

KMB
KMB

Reputation: 1

Building on @dougp's prior response to this query I believe that the original query may have been referring to Crosstab node members (as opposed to columns). When faced with the same issue in a crosstab I was able to resolve this by:

  1. Select the crosstab node members in question
  2. On the Properties pane, change the 'Source Type' (found in the 'Text Source' section) to a 'Data Item Value'
  3. At this point, when you view the 'Data Format' (found in the 'Data' section) you will be able to edit your date formatting.

Upvotes: 0

Related Questions