i Travis and Tobias,

I've modified a simple function, and incorporated it to my framework's datetime.class.php witch handles all date and time conversion... Here it is:

=====================================================================
var $server_timezone_offset = -5;
var $default_timezone_offset = +1;
var $local_timezone_offset = 0;

function timezone($offset=null)
{
if(is_integer($offset))
{
$this->local_timezone_offset = $offset-$this->server_timezone_offset;
return time()+3600*$this->local_timezone_offset;
}
elseif(is_integer($this->default_timezone_offset))
{
$this->local_timezone_offset = $this->default_timezone_offset - $this->server_timezone_offset;
return time()+3600*$this->local_timezone_offset;
}
else
{
return time();
}
}
=====================================================================



Nice regards to you all, Bruno B B Magalhães

On Jan 4, 2005, at 12:44 PM, Travis Conway wrote:
Here has always been a problem I run into with GMT translation. You have to make sure that the system you are working with is set to the correct time zone so that any application trying to automatically figure out the time have the starting point. This is easy enough in Windows, but can mean making sure your /etc/localtime (See http://www.linuxforum.com/linux_tutorials/68/1.php) is correct in linux. Of course there are GUI tools to help with this also for those non-console people. Unfortunately some people rely on shared servers where you do not have root access to change /etc/localtime.

Therefore you must have an overloadable function to return the time in GMT. Where it can accept an offset or rely on the systems timezone.

To me, it seems best to just use a variable. Print out the time, then do a correct offset for it.

But for something already done, see http://us3.php.net/manual/en/function.gmdate.php

Travis

----- Original Message ----- From: "Bruno B B Magalhães" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Tuesday, January 04, 2005 5:04 AM
Subject: [PHP] GMT



Hi you all,

How do you work with GMT time-zones? I mean, I´ve developed a support system, with projects, bugs, tasks, etc... but as I user date()ç,I is 6 hours late from my client´s time-zone...

And I would like to make it a little more dynamic than just put a variable in the code and add to the hour.

Regards,
Bruno B B Magalhães

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to