ADDDATE/SUBDATE(t,a) 

ADDDATE(t,a) and SUBDATE(t,a) are date functions that calculate a date in the future or past.

t: date_or_timestamp_expression

a: numeric value that represents the number of days. Any decimal places in a are truncated if necessary.

 

Result of the ADDDATE(t,a)/SUBDATE(t,a) function

Addition of a to t/
subtraction of a from t

Date value or time stamp value

t or a is NULL value

NULL value

a is special NULL value

Error message

 

Model table: reservation

Increasing a reservation date by two days

SELECT arrival, ADDDATE(arrival,2) arrival2, rno
FROM reservation WHERE rno = 130

ARRIVAL

ARRIVAL2

RNO

01.02.1999

03.02.1999

130