You are here: RE: [PHP] strtotime time zone trouble « PHP « IT news, forums, messages
RE: [PHP] strtotime time zone trouble

Posted by Michael Sims on 01/18/05 18:57

Marcus Bointon wrote:
> Much of the point of using zone names rather than fixed numeric
> offsets is that it allows for correct daylight savings calculations
> (assuming that locale data is correct on the server).
>
> Let me rephrase the question - how can I get the current time in a
> named time zone using strtotime and without using a numeric offset?

This may not be the cleanest way to approach it, but this is what I use and it Works
For Me(TM):

$timeZoneMap = array(
'EST5EDT' => 'Eastern Time',
'CST6CDT' => 'Central Time',
'MST7MDT' => 'Mountain Time',
'PST8PDT' => 'Pacific Time'
);

$currentTime = time();
foreach ($timeZoneMap as $envVar => $timeZone) {
putenv("TZ=$envVar");
print "The current time in $timeZone is ";
print strftime('%m/%d/%Y %I:%M:%S %p %Z', $currentTime)."\n";
}

HTH

 

Navigation:

[Reply to this 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

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