-
[PHP] Help
Hey Im working on a website and im trying to make the banner change at a time of the day
Code:
<? if(date(H) < 18 && date(H) > 6){
echo "<img src="image link">";
}else{
echo "<"img src="image link">";
}
?>
Thats my code but it doesnt seam to like it
anyone see anything?
-
PHP Code:
<? if(date("H") < 18 && date("H") > 6){
echo "<img src=\"image link\">";
}else{
echo "<img src=\"image link\">";
}
?>
Need the quote marks :)
Lew.
-
Thanks alot (+ rep) One more question - Thats saying if its before 6:00PM and after 6:00AM then show a certain image then if its after 6PM show another - its now 7:01PM and its showing the wrong picture?
-
You might want to check that your server is set to the correct time then.
You could check the hour by simply echoing your date("H").
-
Add
PHP Code:
<php date_default_timezone_set("Europe/London"); ?>
This will set the time of the script to GMT (UK Time)
Lew.