SSIS DAY function

The SSIS DAY function is a Date/Time function that returns the day number (1 to 31) from the given date in integer format. This article explains how to use the DAY function with an example and the syntax for getting the day number from the date value is as shown below.


To demonstrate the DAY function, we use the Employee table below, which has 15 records. Please refer to the Union All Transformation, Derived Column Transformation, Built-in methods, and SQL Server articles in SSIS.

Source Table

SSIS DAY function

For this DAY example, add a Data Flow Task and double-click on it to enter the Data Flow region. Next, add the OLE DB Source to read data from the above SQL database table. Please join the OLE DB Source to Derived Column Transformation because it helps to write DAY expressions and create new columns.

Data Flow to add Derived Column

Next, double-click on it to open the Derived Column Transformation Editor. Drag and drop the SSIS DAY function to the row cell under the Expression and replace the <<date>> with the DateTime column to return day numbers (1 to 31). Either you can manually delete the complete <<date>> expression or drag and drop the HireDate column will automatically replace it.

The first expression returns the day number from the HireDate columns. The second SSIS DAY function expression returns the day number from the current system date.

DAY( [HireDate] )

SSIS DAY Function Expression

Click OK to close the Editor window.

Drag and drop the Union All Transformation and connect the Derived Column to it. Next, right-click on the connection node and choose the Enable Data Viewer. Please run the SSIS DAY function package to see the day number from the HireDate column and the current system date.

SSIS DAY Function output