Welcome to Geeklog, Anonymous Thursday, November 21 2024 @ 04:13 pm EST

Geeklog Forums

Timezone Hack

Page navigation


Status: offline

hidden

Forum User
Chatty
Registered: 11/13/03
Posts: 51
Quote by Joe: I think I found the issue with changing timezones and the story edit not working properly.

On line 910, I changed the DB_save call a little. Instead of storing $date, I changed it to FROM_UNIXTIME($unixdate).

That seemed to solve the issue with having a different time after a story is stored.


i guess if should be FROM_UNIXTIME('$unixdate')
we are just shadows of our hidden identities
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
For me it works without any quotes:
Text Formatted Code
,FROM_UNIXTIME($unixdate),
 


geKow
 Quote

Mr Nath

Anonymous
I have read through all of these posts. I have my displayed time correct but my story time still doesn't work. When I finally got that to work it made my story's date to be year 1970 and day and time totally wrong. Has there been any more developments in getting the story time to work. If so could you please just do a 're-cap' for me. TIA. The reason the story thing is frustrating is it sets the time a few hours after I wrote it so it doens't display until the time is reached. Thanks.
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
Have you changed your story.php line 910 the way mentioned above?

Mine is:
Text Formatted Code
DB_save($_TABLES['stories'],'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon',"$sid,$uid,'$tid','$title','$introtext','$bodytext',$hits,FROM_UNIXTIME($unixdate),'$comments','$related',$featured,'$commentcode','$statuscode','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon", $return_to);
 

FROM_UNIXTIME($unixdate) without ANY quotes
geKow
 Quote

Mr Nath

Anonymous
I have just gone through and chnaged the config and lib-common file to start playing again (I put it all back b4). Now the time is working right (www.myvirtualfaith.com). I have now made the changes to story and am getting a parsing error on this line.

$unixdate = strtotime("$publish_month/$publish_day/$publish_year $publish_hour:$publish_minute:$publish_second" EST -17 hours);

Why is this? have I dont it wrong??

And is this right for the other chnage?

$A['unixdate'] = strtotime($A['publish_year'] . '-' . $A['publish_month'] . '-' . $A['publish_day']
. ' ' . $publish_hour . ':' . $A['publish_minute'] . ':00' . 'EST -17 hours');

Thanks...
 Quote

Mr Nath

Anonymous
I moved the "" and the error has gone and it all works. Ta, it was the unixtime thing that was the problem. Thanks again.
 Quote

Status: offline

pibby

Forum User
Newbie
Registered: 12/23/03
Posts: 4
Thanks so much for this info, works great for me Smile
 Quote

Chris

Anonymous
ok... i read through this and am quite amazed that i actually understood some of it haha... i have the correct time showing (changed the config and lib-common), but as far as the story.php edit... when i do that, all it does is show the current time... so if i post a story, come back in a couple minutes... the posted time is STILL the current time... it just keeps ticking...

any fix for this?
 Quote

Anon

Anonymous
Thanks a lot, these two hacks are great.

 Quote

Status: offline

Peter_Apockotos

Forum User
Junior
Registered: 03/18/04
Posts: 29
giggly
I am not sure if this will help you, but I didn't want to have to hack Geeklog on each update. So I put this in my .htaccess file and now the time reported by geeklog is correct.

SetEnv TZ US/Mountain

If you know of any adverse affects of using this, please let me know.
 Quote

Status: offline

Peter_Apockotos

Forum User
Junior
Registered: 03/18/04
Posts: 29
Well this did not seem to help new stories posted. Just the date and time shown on the site and the story editor until you submit it.

Any ideas on how to correct this in the DB automatically without hacking the conf?
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
this is about the timezone hack and not to do with the story posting time... well, i used this "timezone" hack to no avail on 2 diff sites and neither worked. however, i read a comment in the php manual that suggests some various UNIX servers respond to slightly different formating for the putenv.("TZ=.....);

here is what i did and it finally worked:

$_conf['timezone'] = 'PST8PDT'; //notice the change on this line--added to my config.php after the locale settings

//added to lib-common.php after "require once ..."
if ( !empty($_CONF['timezone'])
&& !ini_get("safe_mode")) {
putenv("TZ=".$_CONF['timezone']);
}

so basically it goes "putenv("TZ=PST8PDT"); (i'm in PDT and server is in CDT Razz) and all works just great now. before it was spewing time in GMT and the original hack was just changing the time (not correctly) and not the zone. this works now on apache running on freebsd and also works on apache for windows(not that it needs to).
 Quote

fleppir

Anonymous
angelic
Used both the common-lib and story change and everything is fine @ me.arnists.com thanx for a great hack
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
looking at the read counter, it says that this thread has 3996 hits.
If that ain't a kind of feature request....

geKow
 Quote

Status: offline

exdeath

Forum User
Junior
Registered: 02/13/04
Posts: 23
Quote by machinari: this is about the timezone hack and not to do with the story posting time... well, i used this "timezone" hack to no avail on 2 diff sites and neither worked. however, i read a comment in the php manual that suggests some various UNIX servers respond to slightly different formating for the putenv.("TZ=.....);

here is what i did and it finally worked:

$_conf['timezone'] = 'PST8PDT'; //notice the change on this line--added to my config.php after the locale settings

//added to lib-common.php after "require once ..."
if ( !empty($_CONF['timezone'])
&& !ini_get("safe_mode")) {
putenv("TZ=".$_CONF['timezone']);
}

so basically it goes "putenv("TZ=PST8PDT"); (i'm in PDT and server is in CDT ) and all works just great now. before it was spewing time in GMT and the original hack was just changing the time (not correctly) and not the zone. this works now on apache running on freebsd and also works on apache for windows(not that it needs to).


Where can i find the zone codes for TZ=something
I want my site on Lisbon time.
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
The verry first posting of this thread includes a quite huge list of timezones in the 3rd code field.

geKow
 Quote

Status: offline

hjklassen

Forum User
Junior
Registered: 11/14/03
Posts: 20
I am running GL 1.3.9. I have tried and tried this hack, but it seems to make no difference whatsoever. My host informs me that safe mode is off. I am tearing my hair out! Do I need to indent the $_conf['timezone'] = 'PST8PDT'; 4 spaces? I tried both ways, and nothing seems to make a difference. Anything new on this front?

Thx,
Hans
 Quote

Status: offline

trenchteam

Forum User
Regular Poster
Registered: 06/08/04
Posts: 89
Please let me know when a stable hack for this is done for 1.3.9 That would help. Im a day ahead of my server, so the time is really off badly.
 Quote

Status: offline

hjklassen

Forum User
Junior
Registered: 11/14/03
Posts: 20
I have actually used the above hack (had to change $_conf to $_CONF) for 6 sites, and it works like a hot damn. The only minor issue I have noticed is the story posting time is off by a few hours. Otherwise, I am totally happy with it.

Thanks!

Hans
 Quote

Matt

Anonymous
I think I have read over every single post on this website dealing with timezones at least 10 times. Ive tried the hack a zillion times and a zillion ways--it just wont work. I've even left Geeklog completely several times but keep coming back becasue of a couple of the features I need (like the VERY nice built-in calendar system). But my server is in Japan and I am in Iowa. My website goes along with high school classes that I teach. I decided that I really dont need a pinpoint date and time and I was tired of screwing with it so here is what I did:

Text Formatted Code
$_CONF['language']  = 'english';
$_CONF['locale']    = 'en-gb';
$_CONF['date']      = '%B %Y';
$_CONF['daytime']   = '%B %Y';
$_CONF['shortdate'] = '%B %Y';
$_CONF['dateonly']  = '%B %Y';
$_CONF['timeonly']  = '%B %Y';
$_CONF['default_charset'] = 'iso-8859-1';
 


Wala! Take that you bastard Geeklog!

So whenever there is a date or time it just shows up as the month and year and thats just fine for what I need it for. In posting stories it works just fine and deep down Geeklog still knows what day it is--the highlighted calendar day is still going along with Japan time. But for what I need it for, its an acceptable compromise.

Matt
 Quote

Page navigation

All times are EST. The time is now 04:13 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content