How-To: Add days to a date with Mysql
A common thing you need to do in mysql is add an interval of time to a date in a query. Here is a simple example of how to do this:
SELECT Risk.*
FROM Risk
WHERE (Risk.Next_Reminder_Due IS NULL OR
Risk.Next_Reminder_Due < DATE_ADD(NOW(), INTERVAL 7 DAY))
This returns all ‘risks’ that either have a Next Reminder Due of NULL or within the next week.
Read more about Mysql’s date functions on the Mysql Date & Time Functions Manual Page.

Leave a Reply