How to extract month a from a date and display it as a string in Report studio
This document explains how to extract month from a date field and display it as a string.
Resolving the problem
extract(month,[date data item]) gives the numeric value of a month.(example : 8 for August)
To display it as a string ('August', for example) there are several solutions:
1) Before extracting, change the date format of the date data item to date and date style to Long. Now select 'no' to display years,weekdays and days. Select yes to display months. This when run gives the date displayed as month name.
2) Use a Case Statement
case extract(month,[Order date])
when 1 then 'January'
when 2 then 'February'
when 3 then 'March'
when 4 then 'April'
when 5 then 'May'
when 6 then 'June'
when 7 then 'July'
when 8 then 'August'
when 9 then 'September'
when 10 then 'October'
when 11 then 'November'
when 12 then 'December'
3) Use one of the vendor specific functions depending on the database.
More support for:
Cognos Business Intelligence
Software version: 10.1, 10.1.1, 10.2, 10.2.1, 10.2.2
Operating system(s): Solaris, Windows
Reference #: 1341546
Modified date: 07 December 2016