Forum Moderators: coopster

Message Too Old, No Replies

check if current hour falls in between

         

ahmed24

2:26 pm on Jun 19, 2009 (gmt 0)

10+ Year Member



hey everyone,

i am having trouble getting the following code to work. it is meant to check if the current hour falls in between 19 and 21, but it just doesnt seem to work and only displays one result through all hours.

any ideas ?

<?php

$hour = date("H");

if ($hour >= 19 ¦¦ $hour < 21) {
echo "Its between the time given";
} else {
echo "Its not time";
}

?>

rainborick

2:30 pm on Jun 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try:

if (($hour >= 19) && ($hour < 21)) {