dev09
asked on
SQL Query - Date range filtering
Hi, i'm coding in PHP/MySQL and have the following table data, wondering how to achieve the following SQL queries...
TABLE: 'events'
id title startDate finishDate
1 do this 01/09/2015 9:00 AM 30/09/2015 5:00 PM
2 do that 02/09/2015 9:30 AM 02/10/2015 5:30 PM
3 then this 10/10/2015 8:00 AM 11/11/2015 5:00 PM
SQL Search #1:
SQL Search #2:
SQL Search #3:
Hope someone can shine some light.
Thanks in advance!
TABLE: 'events'
id title startDate finishDate
1 do this 01/09/2015 9:00 AM 30/09/2015 5:00 PM
2 do that 02/09/2015 9:30 AM 02/10/2015 5:30 PM
3 then this 10/10/2015 8:00 AM 11/11/2015 5:00 PM
SQL Search #1:
SELECT * FROM events WHERE (current time is in between `startDate` and `finishDate`)
SQL Search #2:
SELECT * FROM events WHERE (current month is inside of `startDate` and `finishDate`)
SQL Search #3:
SELECT * FROM events WHERE (current week is inside of `startDate` and `finishDate`)
Hope someone can shine some light.
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html