My site has "StartHour" and "EndHour"
Example:
If the current time (1500) is between the StartHour(0800) and EndHour(2300) the site works, then:
$currentTime= date('Hi');
$startTime= $setting_info['start_hour']; //
$endTime= $setting_info['end_hour']; //
if($currentTime>=$startTime && $currentTime<=$endTime)
{
echo "Site Works Perfectly";
}
The problem is when the $endTime
is bigger than 2359 for example, I want that my site works from 0800 to 0200. It won't work because if $currenttime
is 1000 it will be bigger than $startTime
but will be bigger than $endTime
too.
Or if $currenttime
is 0000 it will be smaller than $starttime
and smaller than $endtime
.
I can't figure out how to solve this.
Please help!
Use it like below: