Press "Enter" to skip to content

SSRS Expressions: Format Dates & Numbers

Aim: To format dates & numbers embedded in text strings in SQL Server Reporting Services.

To embed formatted dates in text strings, set the expression for the text string to:

="From " + Format(Parameters!StartDate.Value, "yyyy-MM-dd") + " to " + Format(Parameters!EndDate.Value, "yyyy-MM-dd")

E.g. for @StartDate = 01/02/2017 & @EndDate = 31/03/2017, the string will appear in the report as:
From 2017-02-01 to 2017-03-31

Changing the date format, e.g. from “yyyy-MM-dd” to “dd/MM/yyyy”, will change how the text string appears in the report.


To embed formatted numbers in text strings, set the expression for the text string to:

="Value: " + CStr(Round(Parameters!TotalValue.Value, 2))

E.g. for @Number = 5.1234, the string will appear in the report as:
Value: 5.12

Changing the numeric rounding value, e.g. from 2 to any other number, will change how the text string appears in the report.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *