Hi all, I run my own online radio station and would like to display an image on my website ONLY between 9PM - 4AM, and before this time I wish nothing to be displayed. Please could anyone advise me of the php script that would allow me to do this. Thanks in advance
Hacked this quickly together <?php $showimage = date(H); if ($showimage >= 21 || $showimage <= 03){ echo "<img src='path/to/image.png' >"; } ?> Code (markup): Well, this'll display an image between 21:00 (9PM) and 03:59 (AM) Hope this works
You need to remember that the server timezone may differ from your visitors', so you'll need to take care of the locale.
Hi, Thanks for you help GMF! Works like a charm, i have set it to 5PM and 6PM to test it and it all works Garkoni: I did think about this and in the image i will be displaying i will show GMT (my location) so listeners know thanks also