DaveLinger Posted November 15, 2006 Share Posted November 15, 2006 so my dad wants me to make his website so that if someone goes to it during daylight hours, it shows a daytime photo of the building. At night, it shows the night photo. I figure this can be done with a simple "if" statement, but I don't know how to work with PHP time formats! Quote Link to comment Share on other sites More sharing options...
btherl Posted November 15, 2006 Share Posted November 15, 2006 date('G') will give you the current hour in 24 hour format. so..[code=php:0]$hour = date('G');if ($hour >= 7 && $hour < 17) { # daytime} else { # nighttime}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.