Marcus Bointon wrote:
How is this not a bug?
<?php print date('Y-m-d H:i:s', strtotime('now UTC'))."\n"; print date('Y-m-d H:i:s', strtotime('now PST'))."\n"; ?>
outputs: 2005-01-18 09:58:09 (correct) 2005-01-18 17:58:09 (incorrect)
PST = UTC - 8, therefore if you ask for strtotime in PST it will give you now + 8. This is standard in most languages, you are just reading the functionality back to front.
ie when you say strtotome('now PST'), what you are asking for is the current local time (UTC in your instance) given an input date in PST
The time zone correction is applied in the wrong direction. Does it in both current PHP 4 and 5.
Named time zones like these are supposedly deprecated, but the suggested alternative in the docs doesn't work at all:
print date('Y-m-d H:i:s', strtotime('now UTC-0800'))."\n";
try print date('Y-m-d H:i:s', strtotime('now') -0800)."\n";
Tom
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php