I have two events on two days each week. Both starting on 13:15 at each day. Each tuesday and each thursday. I need to check if the nearest event (from now()) is tuesday (till 13:15) OR thursday (till 13:15) to set the javascript countdown correctly (it will get the date("Y-m-d H:i:s") string for counting)
PSEUDO EXAMPLE:
if( tuesday("13:15") == 'over' && thursday("13:15") == 'remaining' ) {
echo 'Next event start thursday 13:15';
// need time format here for the thursday
} else {
echo 'Next event start tuesday 13:15';
// need time format here for the tuesday
}
I'm struggling with comparing the time ranges:
$now = new DateTime(date("Y-m-d"));
$event_time = '13:15';
$event_tuesday = new DateTime("next tuesday");
$event_thursday = new DateTime("next thursday");
echo $diff_tuesday = $event_tuesday->diff($now)->format("%a");
echo $diff_thursday = $event_thursday->diff($now)->format("%a");
But i think that's anyway wrong. Can somebody give me a hint?