IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
  • 1 reply
  • Latest Post - ‏2013-02-08T12:14:35Z by DanielWagemann
1 Post

Pinned topic Pass month value from date as a parameter

‏2013-02-08T08:32:21Z |

I have some report in Cognos which has two separated columns: Year and Month (not date). So, I must use date parameter (calendar) to get Month and Year from selected date.
So, I tried this solution: MONTH IN (?substring(ParamValue('Month'),6,2)?) where my date is dd-mm-yyyy format.
So, in this case, I should get the "mm" value, but it doesn't work.

Can anyone help with this?

Updated on 2013-02-08T12:14:35Z at 2013-02-08T12:14:35Z by DanielWagemann
  • DanielWagemann
    850 Posts

    Re: Pass month value from date as a parameter

    Assuming your Date field is a date data type, you could use the extract function.

    Although I would stick with the above there are some DB specifc functions available too.
    year(DateColumn) MSSQL
    to_char(Date_Column,'MM') Oracle