Page 1 of 1

Go through range of dates

Posted: Thu Sep 14, 2006 9:09 am
by aquanutz
Hello,

I've got a few tables in MySQL that have ranges of dates (a starting date and an ending date) and in my calendar I want to be able to check the current date against those in the ranges to see if there are events... The only thing is that I can not seem to come up with a good way (or start a good way) to do this. Is there an easy way to see if a date is in a range of other dates?? Thanks for any help.

-thomas

Posted: Thu Sep 14, 2006 9:15 am
by GM
Something like:

Code: Select all

SELECT * 
FROM table_name
WHERE $today_date BETWEEN start_date AND end_date
should do it, where $today_date comes from the PHP script.

Posted: Thu Sep 14, 2006 9:30 am
by aquanutz
You are a freakin' life saver! :D :D :D