Hi Guys, I have a parameter in my SSRS report and a variable that contains the following codes. i already get the month but my problem is how to get the year. speciall if it falls on the previous year. like the example below when i run the report my start month is May and the year is 2012 but when the month falls now on Dec the year should be 2011. how sould i work on this. need your help guys. thanks. Declare @Startdate datetime Set @Startdate='2012/05/09' =MonthName(Month(DateAdd("M",0,Parameters!StartDate.Value)))&"-"&?? --value is May-2012 =MonthName(Month(DateAdd("M",-1,Parameters!StartDate.Value)))&"-"&?? --value is April-2012 =MonthName(Month(DateAdd("M",-2,Parameters!StartDate.Value)))&"-"&?? --value is March-2012 =MonthName(Month(DateAdd("M",-3,Parameters!StartDate.Value)))&"-"&?? --value is Feb-2012 =MonthName(Month(DateAdd("M",-4,Parameters!StartDate.Value)))&"-"&?? --value is Jan-2012 =MonthName(Month(DateAdd("M",-5,Parameters!StartDate.Value)))&"-"&?? --value is Dec-2011
↧
how to get the year in date parameter
↧