COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: gatorfe on 01 Jun 2011 11:00:26 AM

Title: extract the year and month from a date field
Post by: gatorfe on 01 Jun 2011 11:00:26 AM
Hello, how can I  extract the year and month from a date field?  Currently the date field on the report shows as 2011-06-01 and I want to show it as 2011-06. Thanks in advance for any suggestions.
Title: Re: extract the year and month from a date field
Post by: cognos123 on 01 Jun 2011 11:42:59 AM
Change Data Format default  to date  and  change properties for  date 

Date separator '-'
date ordering  'yr,month,day'
Display years 'Yes'
Display Months ' two digits'
Display days and weekdays 'No'

:)
Title: Re: extract the year and month from a date field
Post by: cognos123 on 01 Jun 2011 11:50:34 AM
You can try this one also

TO_CHAR([dataitem],'YYYY - MM')