I am using PHP/MySQLin my project, and I have a table that holds time values, and days of week. The rows are SUNDAY_OPEN SUNDAY_CLOSE etc. for the rest of the week. These hold times like 9:00
and 17:00
.
All I want to do is on a certain time of access, to know whether the NOW() or time() in PHP fall exactly on that time开发者_如何学运维 range.
How about something like:
$day_of_week = strtoupper(date("l"));
$current_hour = date("G:i");
$sql = "
SELECT COUNT(*) AS `open`
FROM `schedule`
WHERE '{$current_hour}' BETWEEN `{$day_of_week}_OPEN` AND `{$day_of_week}_CLOSE`";
精彩评论