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, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook

6 comments:

Smitha Prabith said...

Thanks a lot for the different Date formats
=Format(Today(),"dd-MMM-yy")
is also one which i was using
it gives:
09-Jul-08

Philky 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.

POLLADHAVAN said...

Hi,

I am having a problem with SSRS
I have a column with data type in Time format like
12:24
06:45

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