inline Add time to MySQL dates

Originally published on May 1st, 2020 (Last updated on May 1st, 2020)

The eas­i­est way to move a col­lec­tion of dates by a giv­en amount of time is to use the DATE_ADD-func­tion:

UPDATE [table] SET [column] = DATE_ADD([column], INTERVAL [amount] {DAY|MONTH|MINUTE|...})

This works with DATE and DATETIME columns. A full list of pos­si­ble inter­val-units can be found here.

Comments

No com­ment sec­tion here 😄

You can reach me over at @knuth_dev or send me an Email.