Date add/subtract
The Date add/subtract step adds or subtracts a specified number of time units (days, weeks, months, years, hours, minutes, seconds, milliseconds).
Parameters
-
Input column: required, a date column to add specified number of time units to.
-
Number of units: required, the number of units to be added or subtracted from the selected date. Use negative values to subtract from the date.
-
Unit: required, the time unit to be added/subtracted. Multiple options are allowed:
-
days
-
weeks
-
months
-
years
-
hours
-
minutes
-
seconds
-
milliseconds
-
-
Target column: required, configure the column which will receive the output.
-
Write result to the current column: outputs data into the Input column.
-
Create new column with name: create a new column with the specified name. Name of the new column can contain spaces or special characters - the technical column name will be created automatically. The new column will be placed right next to the Input column.
-
Examples
Sample date: 2023-01-09 03:11:00
Input date | Unit | Number of units | Result | Note |
---|---|---|---|---|
|
Days |
8 |
2023-01-17 03:11:00 |
|
|
Days |
-8 |
2023-01-01 03:11:00 |
|
|
Months |
2 |
2023-03-09 03:11:00 |
|
|
Days |
60 |
2023-03-10 03:11:00 |
Note the difference between adding 2 months vs. 60 days - the months add calendar months so add different number of days depending on the input date. |
|
Minutes |
123456 |
|
Any number works as number of units - there is no need to limit the values to small numbers. |
No value |
Any |
Any |
Error |
Trying to add/subtract to/from empty values results in an error. |
Error |
Any |
Any |
Error |
Applying the step to an Error value results in an Error. |
See also
-
dateAdd
function in CTL.