June 04 2014

Adding number of days to Dates in MySQL

Tagged Under : ,

MySQL
One of my application need update the days when it have set the days inside the records. It was because sometimes user need extend the expired date to following number of days.

With the SQL statement it would be simple to complete the task.
UPDATE table 
SET expired_date = DATE_ADD(expired,INTERVAL 7 DAY) 
WHERE id = 1;
The above example only work on DATE or DATETIME field types. Remember it was day not days

Make a Comment

You must be logged in to post a comment.