I need to check in PHP if the current time is before 2pm that day.
I've done this with strtotime
on dates before, however this time it's with a time only, so obviously at 0.00 each day the time will reset, and the boolean will reset from false
to true
.
if (current_time < 2pm) {
// do this
}
if (date('H') < 14) {
$pre2pm = true;
}
For more information about the date function please see the PHP manual. I have used the following time formatter:
H = 24-hour format of an hour (00 to 23)