ADDDATE(t,a) and SUBDATE(t,a) are date functions that calculate a date in the future or past.
Value t: When used in a function, the expression t (date_or_timestamp_expression) must supply a date, a time stamp, or an alphanumeric value that matches the current date or time stamp format.
Value a: The expression a (expression) supplies a numeric value that represents the number of days. Any decimal places in a are truncated if necessary.
|
Result of the Function ADDDATE(t,a)/SUBDATE(t,a) |
Addition of a to
t/ |
|
t or a is NULL value |
NULL value |
a is a special NULL value |
Error message |
SELECT arrival, ADDDATE(arrival,2) arrival2,
rno
FROM reservation WHERE rno = 130
Postponing the reservation date by two days
ARRIVAL |
ARRIVAL2 |
RNO |
2005-02-01 |
2005-02-03 |
130 |