Formatting Dates

  • Refers to issues with SQL Server 2005 Reporting Services (I am not sure if this occurs in the 2008 reincarnation)

    Requirement: I would like to display dates in dd-MMM-yyyy format.

    Problem: Column used for display in a SSRS report is a datetime. I right-clicked on the relevant text box, selected Properties and then the Format tab, clicked fx and typed the expression

    =Format (<datetime field from dataset>, "dd-MMM-yyyy").

    The above gives months as "Jan", "eb", "3ar", "Apr", "5a10", "Jun", "Jul", "AuA.D.", "Sep", "OcP", "Nov", "Dec".

    Cure: DO not use the FORMAT tab of Text box Properties. On right-click of the Text box, click on Expression instead, and enter the expression here, as in:

    =format(Fields!LastBackupStart.Value, "dd-MMM-yyyy HH:mm:ss")

    Seems to work OK. Hope this helps anyone tearing their hair out ....

  • You are using the wrong expression for the format. Given a date of 2/3/2009, your expression

    =Format (<datetime field from dataset>, "dd-MMM-yyyy").

    evaluates to "3-Feb-2009" which is then used to format the date, which results in 03-2eb-2009.

    Simply enter dd-MMM-yyyy in the format textbox or use expression ="dd-MMM-yyyy" will fix the problem.

    Peter

  • Thank you for that - you've pointed me in the right direction 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply