October 2, 2012 at 5:53 pm
I have the date time field. I want extract only Month and the year. How can I do the same.
Current format of the field is "10/01/2012 hh:mm:ss"
Need to convert to "October 2012"
I want to do these changes in SSRS.
October 2, 2012 at 6:19 pm
deepeshdhake (10/2/2012)
I have the date time field. I want extract only Month and the year. How can I do the same.Current format of the field is "10/01/2012 hh:mm:ss"
Need to convert to "October 2012"
I want to do these changes in SSRS.
Assuming your source data field is a datetime datatype and you don't want the day, you could do something like:
=Format(Fields!YourDate.Value, "MMMM") & " " & CStr(Year(Fields!YourDate.Value))
HTH,
Rob
[font="Tahoma"]*I don't have SSRS open as I type this, so please double check my memory to make sure it works as you wish[/font]
October 2, 2012 at 8:16 pm
Hello Rob,
Few data is correct and few is wrong. Here is the sample output I am getting:
Octaber 12
Jul12 12
SetpAmer
What is the problem?
October 2, 2012 at 10:00 pm
Impossible to know without seeing the data, but I'd guess that the field isn't a datetime datatype, but rather a varchar() where not all of the values are correctly formatted dates.
Take a look at the raw data coming through for that field.
October 2, 2012 at 10:57 pm
Hello,
Originally, that column has Date as Data type. So, now what to do? IS there any other procedure to do this?
October 3, 2012 at 2:12 am
=FORMAT(Field!DateField.Value "MMMM yy")
How about the above?
October 3, 2012 at 10:11 am
This too doesn't work. Is there any other way to do this.
With Format(), I am getting some thing like this:
OctAber
SetAmber
etc
October 3, 2012 at 12:20 pm
I still think you have data that isn't a date. Can you take the SQL out of your dataset and manually run it in SMSS? What does that data look like in that field?
Rob
October 3, 2012 at 2:55 pm
Hello Rob,
Can u also tell how to covert if the data type is varchar.
Thanks in advance.
October 4, 2012 at 5:34 am
In SSRS you would use the CDate() function to change from varchar() to datetime; but the issue is that you have non-date values (Amber) mixed into that column. Check your source data, see what that shows.
HTH,
Rob
November 26, 2012 at 9:55 am
for the Amber thing, just do a replace command to remove it before you format the date Replace("Amber", "")
Marvin Dillard
Senior Consultant
Claraview Inc
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply