Adding six hours to my timestamps...

Author Message

Valentin Svelland

Friday 10 October 2003 2:54:17 pm

I'm still troubled over this little thing; I've got my Norwegian site on american server and naturally the timestamps on my articles reflects american time zone.

How do I add 6 hours to my timestamps to reflect local time? Thomas Schamm already pointed out which file to work on, but I can't get the syntax/code right:

http://www.ez.no/developer/ez_publish_3/forum/setup_design/add_hours_to_clock_due_to_servers_in_other_time_zone

Any help would be much appreciated!!

Best regards
Valentin

------------------------
I made eZ run on www.eigersund.kommune.no, bjerkreim.kommune.no, lund.kommune.no and sokndal.kommune.no. Municipalities should use open source!

Thomas Schamm

Friday 10 October 2003 3:33:34 pm

Hi Valentin,

I'm not sure anymore, if you can change the timezone in the /share/local file. But i tested another workaround, it worked on my server, i hope it works with your's too:
To change your time from american to norway (6 hours timedifference), you have to make changes in your template files. May '$publishtime' be the time which should be changed.

{let correctedtime=sum($publishtime, 21600)}
{$correctedtime|datetime(custom, "%H:%i:%s")}
{/let}

This code does the following: The $publishtime (when you posted your article) is the amount of seconds passed since the Unix Epoch (January 1 1970 00:00:00 GMT). Because of the US lying in the west of you, you have to add to the $publishtime a constant value to get the norway time (21600, in seconds). Then you post the $correctedtime with the format you want to use (this may be mine as i wrote it or the standard one).

I hope this will help you getting the 'normal' time, but you have to change your template code everytime when you want to get your 'local time'. If someone know, where to change the kernel, so that the timeoffset is done by one integer by default, it would be nice to post it here.

Greetings and sleep well, Thomas

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.