Help about time

Hi to everybody, Im a beginner and i have a little problem with this script

if ($d == 3 && $h >= 0 && $h < 20) $img = ‘’;

For midnight the time 0 don’t work, before wednesday i have the same but is finished to hour 24. Thats work but when time go after midnight i don’t have image to my site

Can you help me please about hour after midnight?
When i put h = 1 at one o clock in the morning everything is ok

Thanks a lot!

I don’t see the problem, just tested:

ty for your answer, but i don’t understand, on my web site after midnight does not work,
when the time is 1 o click is ok
i tested to your link but give to me nothing…

The timezone setting is probably not what you expect, so the result is off.

Have you specifically set the timezone setting? What is your code setting $h? Do you get the correct date and time when you add the following to your php code -

echo date('Y-m-d H:i:s');
<?php $h = date('G'); //set variable $h to the hour of the day $d = date('w'); //set variable $d to the day of the week. $year = date('Y'); //set variable $year to the current year //G is the date key for hours in 24 format (not 12), with no leading 0s, like 02. // Adjust 2 hour offset for MST below. $h = $h+2;

Unless your code addresses rollover at midnight, you cannot simply add hours like that. 22 hours should result in 0. 23 hours should result in 1.

You should just set the timezone setting to a value that will give the correct result from the date() calls.

ty you but the problem is that the script have to use greek hour… to show image of current Dj…on the radio (

Sponsor our Newsletter | Privacy Policy | Terms of Service