Topic
  • 1 reply
  • Latest Post - ‏2013-02-08T12:14:35Z by DanielWagemann
milan_krivic
milan_krivic
1 Post

Pinned topic Pass month value from date as a parameter

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

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?

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

    Re: Pass month value from date as a parameter

    ‏2013-02-08T12:14:35Z  
    Assuming your Date field is a date data type, you could use the extract function.
    
    extract(
    'month',[DateColumn])
    


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