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


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter


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

 
  Feedback:

comments

6 Responses to "Format dates in SSRS reports"
  1. Smitha said...
    July 9, 2008 at 12:03 AM

    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

  2. P said...
    July 23, 2009 at 12:51 PM

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

  3. Suprotim Agarwal said...
    July 26, 2009 at 10:23 PM

    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

  4. Anonymous said...
    December 9, 2010 at 5:56 AM

    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.

  5. POLLADHAVAN said...
    January 20, 2011 at 12:04 PM

    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.

  6. Ezhumalai M said...
    July 24, 2012 at 9:35 PM

    Thank for your post.lot of helpfulness for me

 

Copyright © 2009-2014 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions