Extracting SQL DATE from a column
4 answers
If it is a datetime column use the function DATE_ADD()
:
UPDATE customer SET register_date = DATE_ADD(register_date, INTERVAL 5 DAY)
0
source to share
Using DATE_ADD()
You can use a function DATE_ADD()
to handle adding a given interval (e.g. days, minutes, hours, etc.) to an existing date column:
UPDATE customer
SET register_date = DATE_ADD(register_date, INTERVAL 5 DAY)
Using date arithmetic
Alternatively, you can simply use date arithmetic, which is similar to the previous example:
UPDATE customer
SET register_date = register_date + INTERVAL 5 DAY
0
source to share