Description
Adds a specified number of time units to a date or timestamp. Subtract by providing a negative value.
Syntax
DATEADD(datepart, value, timestamp)
Parameters
| Parameter | Description | Data Type | Required |
|---|---|---|---|
| unit | Date or time part (for example day, month, year) | String Literal | Yes |
| amount | The amount argument | Integer | Yes |
| date_or_timestamp | Date or timestamp value | Date or timestamp | Yes |
Accepted datepart values
| Datepart Name | Datepart Abbreviation |
|---|---|
| year | yy, yyyy |
| month | mm, m |
| day | dd, d |
| hour | hh |
| minute | mi, n |
| second | ss, s |
Notes
- Unit must be string literal.
Example
SELECT
DATEADD('day', 7, start_date)
FROM
rippling.employee.Employee
LIMIT
5;