Reputation: 89
I want to put in the field the following expression: =Year(Fields!TaskOpenDate.Value) + "-" + Month(Fields!TaskOpenDate.Value)
that I want is to show in the field like this: 02-2014.
How do I do that?
Upvotes: 1
Views: 1082
Reputation: 6073
This will give your required date format
= Right("0"+CStr(Month(Fields!TaskOpenDate.Value)),2) +"-"+
CStr(Year(Fields!TaskOpenDate.Value))
Upvotes: 0
Reputation: 39566
Since it seems like TaskOpenDate is already a DateTime
, you can just Format
this the way you want:
=Format(Fields!TaskOpenDate.Value, "MM-yyyy")
Upvotes: 3
Reputation: 2042
You're close but Year() and Month() return data as Integers. You're then using the + operator on the Integers returned by Year() and Month() to try and concatenate those with a string, which is confusing it.
Just convert the return from Year() and Month() to string as well, and it'll be fine:
=CStr(Month(Fields!TaskOpenDate.Value)) + "-" + CStr(Year(Fields!TaskOpenDate.Value))
Upvotes: 0