SSRS DateSerial Function

The SSRS DateSerial function is a Date and Time function that will construct a date value from the specified year, month, and day information and set the time value to midnight (00:00:00). If your data has individual year, month, and day columns, use this DateSerial to construct the complete date. The syntax of the SSRS DateSerial function to build the required date value from the given year, month, and day values is shown below.

=DateSerial(2023, 12, 31)

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

Source Table

SSRS DateSerial function Example

For this, let me add a new column to the right side of the Hire Date column and name it DateSerial. Next, right-click the textbox under Now 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 construct the dates. We don’t have any dedicated columns with year, month, and day values. First, the below code uses the Year, Month, and day functions to extract them from the Hire Date column. To show the difference, we have added 4 years, 2 months, and 15 days to the Hire Date. Next, the SSRS DateSerial function uses the extracted year, month, and day values to construct or build date values.

=DateSerial(Year(Fields!HireDate.Value) + 4,
Month(Fields!HireDate.Value) + 2,
Day(Fields!HireDate.Value) + 15)
SSRS DateSerial Function  expression to construct Date from year, Month, and Day values

Similarly, let me add a new column. In this example, we use the DatePart function to get individual parts. For more functions >> Click Here!

=DateSerial(DatePart("yyyy", Fields!HireDate.Value) - 10,
DatePart("m", Fields!HireDate.Value) + 3,
DatePart("d", Fields!HireDate.Value) - 1)

Please click the preview tab to see the report. As you can see, it set the time to midnight by default. If you want to show the date only, Go to Text Box Properties -> Number -> Change Category to Date and choose the type.

SSRS DateSerial Function  to Build Date from year, Month, and Day values preview