SSRS CDate Function

The SSRS CDate function is a Conversion function that will convert the given field or expression to a Date. Sometimes, we get the date in string format; in such a scenario, we use this built-in function. The syntax of the CDate function for converting string to date is as shown below.

=CDate(Fields!HireDate.Value)

To demonstrate the CDate function in reporting services, we use the Employee table below, which has 20 records. The image shows the records in the Table report.

Source Table

SSRS CDate function Example

To demonstrate this, we created two calculated fields and converted the BirthDate and Date First Purchase fields to String format using the CStr function.

Let me add a new column to the right side of the PurchaseDate column. Next, right-click the textbox under the Pur Date and choose Expression to open the below expression window. The SSRS CDate function expression below will convert the string format of the PurchaseDate column to Date and Time.

  1. More Functions
  2. Charts
  3. Tables
  4. Format tables
  5. SSRS
=CDate(Fields!PurchaseDate.Value)
SSRS CDate Function expression to convert string to Date

Similarly, let me create one more new column to convert the string BirthDate to date and time. The SSRS CDate function expression to perform the same is as shown below.

=CDate(Fields!Birth_Date.Value)

Please click the preview tab to see the CDate report.

SSRS CDate Function to convert string to Date and Time report