PartyRing Posted August 28, 2007 Share Posted August 28, 2007 Ive got this php code which changes an image at a specific server time: <?php $timeOffset = + 0; // in hours, positive or negative $nowHour = date("H", time() + (3600 * $timeOffset)) ; if ($nowHour >= 16 && $nowHour < 0) $message = '<img src="image1">'; else if ($nowHour >= 0 && $nowHour < 6) $message = '<img src="image2">'; else if ($nowHour >= 6 && $nowHour < 17) $message = '<img src="image3">'; else $message = '<img src="otherimage">'; print($message); ?> And it works, i think, but theres a time problem, can anyone help or work out whats wrong? Quote Link to comment https://forums.phpfreaks.com/topic/67082-image-change-with-time/ Share on other sites More sharing options...
Jessica Posted August 28, 2007 Share Posted August 28, 2007 It works but there is a problem? Excellent. We can help if you actually explain. Quote Link to comment https://forums.phpfreaks.com/topic/67082-image-change-with-time/#findComment-336428 Share on other sites More sharing options...
PartyRing Posted August 28, 2007 Author Share Posted August 28, 2007 Well, i imported it into my page, so that a daytime/nighttime image comes up according to the time of day. I think theres either a problem with the server times, so it doesnt know what time it is, therefore goes to the default image. OR Its the crossover times, because at the point its sopposed to change where the > and < times are the same, it also defaults. If you don't understand, please tell me and ill try and explain further Quote Link to comment https://forums.phpfreaks.com/topic/67082-image-change-with-time/#findComment-336436 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.