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/ |
|
t or a is NULL value |
|
a is special NULL value |
Error Message |
Example 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/2002 |
03/02/2002 |
130 |