SSRS FormatDateTime Function

The SSRS FormatDateTime function is a Date and Time function that formats the given DateTime field using the specified DateFormat option and returns the string representation of the date and/or time value. The syntax of the FormatDateTime function to convert the given date to a Long and Short Date and time to a Short or Long Date is as shown below.

=FormatDateTime(Fields!HireDate.Value, DateFormat.ShortDate / LongDate / ShortTime / LongTime)

To demonstrate the SSRS FormatDateTime function, we use the Employee table below, which has 15 records. The image shows the records in the Table report.

Source Table

SSRS FormatDateTime function Example

For this, let me add a new column to the right side of the Hire Date column and name it the Format DateTime. Next, right-click the textbox under Format DateTime and choose the Expression. To understand the report, I suggest you refer to the articles on charts, tables, grouping, and format tables in SSRS.

Choose the expression option

It opens the following expression window to format the given datetime. The below SSRS FormatDateTime function formats the Employee Hire Date column to the Long Date. It includes the Weekday name, Month Name, Date, and Year.

=FormatDateTime(Fields!HireDate.Value, DateFormat.LongDate)
SSRS FormatDateTime Function expression to format date and time

Similarly, let me add two more columns to convert the Hire Date to Short data and long time. The expressions for ShortDate and LongTime are as follows.

=FormatDateTime(Fields!HireDate.Value, DateFormat.ShortDate)

=FormatDateTime(Fields!HireDate.Value, DateFormat.LongTime)

Please click the preview tab to see the report. For more functions >> Click Here!

SSRS FormatDateTime Function to format date and time to long and short preview