|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-06 08:34 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 20:00:01 2025 UTC |
Description: ------------ When using strtotime($timezone), where $timezone is the timezone abbreviation, it adds negative offsets and subtracts positive offsets to the time. If you add a date string, e.g. "April 10, 2009 9:20 AM MDT", the same problem occurs. Reproduce code: --------------- <?php // It is currently 9:55 pm PDT. Default time zone is PDT. echo date('g:i a', strtotime('HADT')) . " \n"; echo date('g:i a', strtotime('AKDT')) . " \n"; echo date('g:i a', strtotime('PDT')) . " \n"; // This is the only correct one. echo date('g:i a', strtotime('MDT')) . " \n"; echo date('g:i a', strtotime('CDT')) . " \n"; echo date('g:i a', strtotime('EDT')) . " \n"; ?> Expected result: ---------------- 7:55 pm 8:55 pm 9:55 pm 10:55 pm 11:55 pm 12:55 am Actual result: -------------- 11:55 pm 10:55 pm 9:55 pm 8:55 pm 7:55 pm 6:55 pm