That makes sense. Okay so I'm doing this to check for the day of the week and time:
$weekday = date("l");
$hour = date("h");
$minute = date("i");
$meridiem = date("A");
echo $weekday . " " . $hour . ":" . $minute . " " . $meridiem;
//check the day of the week and time to determine if online ordering is available
if($weekday == "Sunday" || $weekday == "Monday" || $weekday == "Tuesday" || $weekday == "Wednesday")
{
if($hour < 11 && $minute < 0 && $meridiem == "AM" || $hour > 10 && $minute > 45 && $meridiem == "PM")
{
echo "Sorry, Online ordering is unavailable at this time. <br><br>
Online Ordering hours are: <br>\n
Sunday - Wednesday, 11:00 AM to 10:45 PM.<br>\n
Thursday 11:00 AM to 11:15 PM<br>\n
Friday and Saturday 11:00 AM to 12:45 AM.";
}
else
{
echo "Hello<br>\n";
}
}
if($weekday == "Thursday")
{
if($hour < 11 && $minute < 0 && $meridiem == "AM" || $hour > 23 && $minute > 15 && $meridiem == "PM")
{
echo "Sorry, Online ordering is unavailable at this time. <br><br>
Online Ordering hours are: <br>\n
Sunday - Wednesday, 11:00 AM to 10:45 PM.<br>\n
Thursday 11:00 AM to 11:15 PM<br>\n
Friday and Saturday 11:00 AM to 12:45 AM.";
}
else
{
echo "Hello<br>\n";
}
}
if($weekday == "Friday" || $weekday == "Saturday")
{
if($hour < 11 && $minute < 0 && $meridiem == "AM" || $hour > 24 && $minute > 45 && $meridiem == "PM")
{
echo "Sorry, Online ordering is unavailable at this time. <br><br>
Online Ordering hours are: <br>\n
Sunday - Wednesday, 11:00 AM to 10:45 PM.<br>\n
Thursday 11:00 AM to 11:15 PM<br>\n
Friday and Saturday 11:00 AM to 12:45 AM.";
}
else
{
echo "Hello<br>\n";
}
}
Today is Wednesday and it is before 11:00 AM and not later than 10:45 PM. Therefore it should display the message saying that online ordering is unavailable. Instead it keeps displaying "Hello"
Do I have the logic wrong?
Thanks for your help guys.