|
Posted by Alvaro G. Vicario on 07/07/06 19:00
*** Hoopster escribió/wrote (Fri, 07 Jul 2006 05:39:09 GMT):
> However, my server is 2 hours difference from me. What is the exact
> command that I can use to offset it.
Some unsorted ideas:
<?
echo "System: " . date('H:i:s (T)') . "\n";
$tz_offset=2*60*60; // 2 hours
echo "Offset: " . date('H:i:s', time()+$tz_offset) . "\n";
putenv('TZ=US/Pacific');
echo getenv('TZ') . ": " . date('H:i:s (T)') . "\n";
putenv('TZ=CET');
echo getenv('TZ') . ": " . date('H:i:s (T)') . "\n";
?>
In my computer it prints:
System: 20:57:13 (Hora de verano romance)
Offset: 22:57:13
US/Pacific: 19:57:13 (Pac)
CET: 18:57:13 (CET)
The putenv() examples display incorrect values, probably because they're
system-dependent and I was just guessing.
Since version 5 PHP has a new time zone directive, but I haven't tried it:
date.timezone string
The default timezone used by all date/time functions if the TZ environment
variable isn't set. The precedence order is described in the
date_default_timezone_get() page.
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
[Back to original message]
|