Modifying a php script to reflect local time

rogersjr

Verified User
Joined
Mar 15, 2004
Messages
25
Location
Australia
In light of the successful modifying (due to advice received on this forum) of a perl script to reflect local time I decided to revisit a php link tracking script that I use.

Some time ago the author of the script advised me to modify the line below to adjust for Victoria being 10 hours ahead of GMT. I changed the line in all 4 places that it appeared in the 2 files but unfortunately the mod had no effect and the author's website has now disappeared. I have tried a number of variations but nothing works. I am hoping that he made an error that will be obvious to someone with more php knowledge than I have.

$today=(int)(time()/86400); (original line)


$today=(int)((time()+10*3600)/86400); (line moded by author)
 
Last edited:
Hello,

Looks right to me.. you could try adding more parenthesis to gurantee the order of operations (time+10)*3600 vs time+(10*3600). It should be right as you have it, but just something to consider.

Note that the "today" value you've shown will only show the number of days since Jan 1st 1970.. an offset of 10 hours will only affect when the day is changed, but won't have any affect on any clocks that are showing up. They'd probably be somewhere else, but if you've done a similar task for them too, then they're probaly fine.

If the site is no longer showing up, then have a look in you apache error logs to see why it's broken. (should give you a line number and error).

John
 
Thanks for the explanation. It was the "somewhere else" that was causing the problem. All works well now.
 
Back
Top