Click to See Complete Forum and Search --> : dates


Shaolin
02-05-2009, 05:57 PM
Hi Guys

I have a table with the following columns:

id, name, start_date, end_date

How can I check whether the current date is inbetween the start/end dates ?

skywalker2208
02-05-2009, 06:01 PM
I think it would be start_date >= date you are checking AND end_date <= date you are checking

Phill Pafford
02-09-2009, 11:39 AM
Haven't tested


SELECT id, name, start_date, end_date, NOW() AS today
FROM table_name
WHERE today BETWEEN start_date AND end_date
ORDER BY today DESC