February 11, 2008

Format dates in SSRS reports

Displaying dates in different formats in your reports is a very common requirement that one faces while working with Sql Server Reporting Services (SSRS).

Let us see how we can display dates in different formats :

=Format(Fields!myDate.Value, “M/d/yy”) - 2/11/08
=Format(Fields!myDate.Value, “MM/dd/yyyy”) - 02/11/2008
=Format(Fields!myDate.Value, “d-MMMM-yy”) - 11-December-08
=Format(Fields!myDate.Value, “d-MMM-yyyy”) - 11-Dec-2008 =Format(Fields!myDate.Value, “M/d/yyyy H:mm”) - 2/11/2008 13:50
=Format(Fields!myDate.Value, “MMM-dd-yyyy”) - Feb-11-2008

About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal


Smitha said...

Thanks a lot for the different Date formats
is also one which i was using
it gives:

P said...

Thank you for this post. one thing I want to do is get the previous year using MMM-yy.

Suprotim Agarwal said...

P - You will have to get the previous date in your SQL query and then use the same expression to convert it to MMM-yy. Since you haven't mentioned any other conditions on which month of the previous year, here's a post that may help you out

Finding the date last year based on the current week

Anonymous said...

Hi, I'm doing something like this

"=Format(Fields!dataRef.Value,"MMMM")+ "/"+Format(Fields!dataRef.Value, "yyyy")"

Can I translate the month's name to portuguese?

Thank you.



I am having a problem with SSRS
I have a column with data type in Time format like

I need to sum up the values and display as a total.

Can any one provide me the expression please.

Ezhumalai M said...

Thank for your post.lot of helpfulness for me