Posted on: 02/01/02 01:31pm
By: Anonymous (Temporalis)
Apart from the prob of being unable to vote on polls at the moment, there's the other prob of time zone settings, i'd like it to display GMT although the server is on EST.
I'm new to this stuff, but the ease at which i've been able to configure and modify GL has impressed me greatly.
Thanks in advance.
Ditto
Posted on: 05/14/02 11:38pm
By: gene_wood
I need the exact same thing. In
this[*1] post Tony says it's on the to-do list so hopefully this will be in a soon to arrive release.
Here's to hoping,
Gene Wood
Hack for time zone change
Posted on: 05/22/02 10:38pm
By: jlhughes
In lib_common.php is a function called
function COM_getUserDateTimeFormat($date='')
The time is determined by calls to the PHP function time(), which returns the number of seconds from the Unix epoch for the sever time. In my case, I need to change from EST to PST.
What I've done is subtract 10800 seconds (3 hours of seconds) from the time() in three places in the function:
if (empty($date)) {
// Date is empty, get current date/time
$stamp = time()-10800;
} else if (is_numeric($date)) {
// This is a timestamp
$stamp = $date-10800;
} else {
// This is a string representation of a date/time
$stamp = strtotime($date);
$stamp = $stamp-10800;
}
The only problem is that the date format set in the config.php has $Z for time zone at the end of the date format. Since I don't know how to adjust that, I removed the $Z. The line in config.php now looks like:
$_CONF['date'] = '%A, %B %d %Y @ %I:%M %p';
This works for the date displayed in the header and for the date when articles are created. It DOES NOT change the system date that is reported when users log out of the system.
I just did this tonight and so I haven't had a chance to see yet if there will be any unexpected consequences of this hack.
Hack for time zone change
Posted on: 05/23/02 01:10pm
By: gene_wood
Sweet idea. I'll try implementing it on my site and see if I can get it to work. I'll let you know. Thanks a truckload.
Hack messes up calendar
Posted on: 05/23/02 07:02pm
By: jlhughes
The law unintended consequences: This hack disrupts the calendar event times.
Hack for hack to shift time zone
Posted on: 05/23/02 07:31pm
By: jlhughes
OK, I've figured out why the times in the calendar got messed up. If anyone knows how to get the timezone to display correctly, I'd love to hear about it.
Anyway here's what I've changed in lib_common.php in the function COM_getUserDateTimeFormat($date='')
//Subtracting seconds from time() to shift
//time zone from server to local zone
//in this case shift is 10800 seconds or 3 hours
if (empty($date)) {
// Date is empty, get current date/time
// This is used for displaying date/time page loaded
$stamp = time()-10800;
} else if (is_numeric($date)) {
// This is a timestamp
// This is used to display story creation dates
$stamp = $date-10800;
} else {
// This is a string representation of a date/time
// This is used to translate stored calendar info
// into date format. DON'T subtract here.
$stamp = strtotime($date);
}
I've checked the page load date-time, the story creation date-time and the calendar events. All work as desired now, displaying local (Pacific) time for Geeklog running on server on East Coast.
This DOES NOT change system message times, which I believe are being created by the mySql calls.
Rethinking hack for time zone
Posted on: 05/24/02 11:58am
By: jlhughes
The basic idea is the same: subtract 10800 seconds or 3 hours. The question is where.
What I've done is searched all of the Geeklog files for time(), which is the function that returns the server Unix time stamp. At every place where the function is used by itself to set a variable I have subtracted the seconds for my time zone.
For instance, in the function COM_getUserDateTimeFormat($date='')
//Subtracting seconds from time() to shift
//time zone from server to local zone
//in this case shift is 10800 seconds or 3 hours
if (empty($date)) {
// Date is empty, get current date/time
// This is used for displaying date/time page loaded
$stamp = time()-10800;
} else if (is_numeric($date)) {
// This is a timestamp
// This date variable should already have been adjusted
// in the calling page
$stamp = $date;
} else {
// This is a string representation of a date/time
// This is used to translate stored calendar info
// into date format. DON'T subtract here.
$stamp = strtotime($date);
}
The time() function is called in lib_common.php, comment.php, pollbooth.php, submit.php, admin/users.php, admin/event.php, admin/story.php and calendar.class
By changing =time() to =time()-10800 in the appropriate areas (NOT where time() is already adjusted by other variables), I've been able to shift the time zone for my site.
The only place where this DOES NOT work is with times derived from Geeklog's interaction with mySql. The logout "System message" reports the server time.
Also, articles that must be approved are dated with the mySql server time. (The admin-level articles, where the user can adjust the publication date/time, show the adjusted time AND store that adjusted time.)
For the record, this is ONLY necessary because my site is designed to be used solely by people who live in one time zone; for sites with a broader audience, it makes no sense to go to this much trouble.
John Hughes
Rethinking hack for time zone
Posted on: 10/04/02 02:27pm
By: Anonymous (rekcah5)
Instead of deleting the %Z from the $_CONF['date'] can't you just replace the %Z to your time zone for instance this is what I have:
$_CONF['date'] = '%A, %B %d %Y @ %I:%M %p MST';
It seems to work.
time zone settings
Posted on: 02/02/05 08:20pm
By: Anonymous (jthompson)
I know this is an old thread but I found an EZ solution for this problem.
Just add the:
putenv("TZ=America/New_York"

;
line to your config.sys file. I put it above the:
$_CONF['language'] = 'english';
line. The link below has another link of all available time zones.
Here is where I found the info:
http://www.modwest.com/help/kb5-258.html
Hope this helps someone.