Reply to Re: Time help

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация