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.

eZ debug

Timing: Jan 18 2025 22:35:35
Script start
Timing: Jan 18 2025 22:35:35
Module start 'layout'
Timing: Jan 18 2025 22:35:35
Module start 'content'
Timing: Jan 18 2025 22:35:36
Module end 'content'
Timing: Jan 18 2025 22:35:36
Script end

Main resources:

Total runtime0.7968 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 589.0703152.6250
Module start 'layout' 0.00500.0034 741.695339.4453
Module start 'content' 0.00840.7871 781.1406524.8203
Module end 'content' 0.79550.0013 1,305.96098.1563
Script end 0.7968  1,314.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4328160.0002
Check MTime0.00150.1873160.0001
Mysql Total
Database connection0.00060.070810.0006
Mysqli_queries0.750594.1857540.0139
Looping result0.00040.0558520.0000
Template Total0.766596.220.3833
Template load0.00200.254520.0010
Template processing0.764595.937920.3822
Template load and register function0.00010.012410.0001
states
state_id_array0.00080.094610.0008
state_identifier_array0.00160.195620.0008
Override
Cache load0.00170.2107200.0001
Sytem overhead
Fetch class attribute can translate value0.00050.068820.0003
Fetch class attribute name0.00120.151430.0004
XML
Image XML parsing0.00060.080920.0003
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00080.0973160.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs