[Pmwiki-users] TimeZone difference from server location mini-hack

Jonathan Scott Duff duff
Tue Oct 28 08:27:08 CST 2003


On Tue, Oct 28, 2003 at 09:29:02AM +0100, Jonas Montonen wrote:
> Hi All.
> 
> A had some problem with the "Updated" timestamps since my hosting is in the
> US and i'm located in Sweden.
> I added these lines tom my local.php to display the corresponding time in
> Sweden for my updates.
> 
> $ServerTimeZoneDiff = 9;
> $Now = time()+$ServerTimeZoneDiff*3600;
> 
> I guess it's not that common that you want to display a different time from
> the servers... but you never know ;)

Since pmwiki uses strftime() to format the time on output, a better
solution would be to set the timezone in local.php.  Changing $Now
directly like that affects every place in pmwiki.php that $Now is used
while setting the timezone just changes how the time information is
output.  Also, since you've hardcoded the difference as 9 hours, you
won't get the proper local time during daylight saving time (assuming
that Sweden observes DST)

I think to set the time zone it would just be something like:

	putenv("TZ=CET2CEST");

I'm guessing on the timezone as I don't know the proper specification
for Sweden other than what I've gleaned from a quick Google search.

-Scott
-- 
Jonathan Scott Duff
duff at lighthouse.tamucc.edu



More information about the pmwiki-users mailing list