Tuesday, May 23, 2017

Show an alert from hour X to hour Y

Hi I want to show an alert from hour X to hour Y

I have:

$currhour = date('H')

    if($currhour > 18 || $currhour < 22)
       return 'yes alert';
    else
       return 'no alert';

Assuming the $currhour is equal to 11. Here is a problem beacause I want to show this alert only if the currhour is on the interval 18 - 22. Another case is when the interval 18 - 9 (the next day).. here will work well because 11 it's < than 18 and 11 it's > than 9..

How can I solve all of the case?



via Argift65

Advertisement