All Products
Search
Document Center

Realtime Compute for Apache Flink:DATE_ADD

Last Updated:Mar 25, 2026

DATE_ADD(startdate, days) returns the DATE that is days days after startdate.

Limitations

Supported only in Realtime Compute for Apache Flink that uses Ververica Runtime (VVR) 3.0.0 or later.

Syntax

DATE DATE_ADD(VARCHAR startdate, INT days)
DATE DATE_ADD(TIMESTAMP time, INT days)

Parameters

ParameterData typeDescription
startdateVARCHARA date string in yyyy-MM-dd or yyyy-MM-dd HH:mm:ss format.
timeTIMESTAMPA timestamp value.
daysINTThe number of days to add.
Note

If any input parameter is NULL or a parsing error occurs, the function returns NULL.

Returns

DATE — the date that is days days after the input date.

Examples

The following examples use this test data:

datetime1 (VARCHAR)nullstr (VARCHAR)
2017-09-15 00:00:00NULL

Test statements

SELECT
  DATE_ADD(datetime1, 30)                       AS var1,  -- VARCHAR input: 2017-09-15 + 30 days
  DATE_ADD(TIMESTAMP '2017-09-15 23:00:00', 30) AS var2,  -- TIMESTAMP input: date portion + 30 days
  DATE_ADD(nullstr, 30)                         AS var3   -- NULL input: returns NULL
FROM T1;

Results

var1 (DATE)var2 (DATE)var3 (DATE)
2017-10-152017-10-15NULL

Key observations:

  • var1 and var2 both produce 2017-10-15 because September 15 + 30 days = October 15, regardless of whether the input is VARCHAR or TIMESTAMP.

  • var3 is NULL because the input nullstr is NULL.