DATEADD adds a specified interval to a date or time value.

Syntax


DATEADD ((intervalType , count , dateInput)

Arguments

  • intervalType: any of these interval types: MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR.

  • count: any constant or expression that can be resolved to an INTEGER data type.

  • dateInput: any expression that can be resolved to a DATE or TIMESTAMP data type.

Returns

  • The same data type as dateInput.

Examples


DATEADD(DAY, 2, timestamp('2013-07-23 23:59:59'))

-- Returns
2013-07-25 23:59:59