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

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

Reply via email to