I'm trying to check for a specific time condition, but for some reason I cannot get it to work. Only the FIRST condition gets applied. It seems to me the second condition should be applied as it is past 9:59am central time.
I have:
<?php
$timezone = date_default_timezone_set('America/Chicago');
$TheDate = strtotime("April 1, 2016, 12:00 am");
if ($TheDate >= strtotime("March 30, 2016, 12:00 am") && $TheDate <= strtotime("April 1, 2016, 9:59 am")) {
global $eventMsg;
echo 'My name';
}
else if ($TheDate >= strtotime("April 1, 2016, 4:12 pm") && $TheDate <= strtotime("April 1, 2016, 4:59 pm")) {
global $eventMsg;
echo 'His name';
}
else {
global $eventMsg;
echo 'Pete\'s name';
}?>
I tested this two days ago and it was working while we were in the month of March, now I'm being fooled. Does anyone have an answer?
I played around with the code and figured out what I was trying to do, also with the help of Charlotte and the PHP Manual.
I simply added the time() function and formatted the time/date parameter.