ZF-12390: Long Timezones in Zend_Date constructor ignored with custom date format

Issue Type: Bug Created: 2012-08-28T09:48:19.000+0000 Last Updated: 2013-04-05T16:07:24.000+0000 Status: Closed Fix version(s): Reporter: George Steel (georgesteel) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

Related issues: Attachments:


When creating a date in a specific timezone using a custom date string and format specifier, if the timezone contains underscore or dashes, the timezone is ignored.

<pre class="highlight">
$customDateString = '2/9/2012 13:11:00 America/Los_Angeles';
$customFormat = 'd/M/yyyy H:m:s zzzz';
$date = new Zend_Date($customDateString, $customFormat);
echo $date->toString(Zend_Date::RFC_850) . PHP_EOL;
// Expected Result: Sunday, 02-Sep-12 13:11:00 America/Los_Angeles
//   Actual Result: Sunday, 02-Sep-12 13:11:00 Europe/London

 * Workaround
$date = new Zend_Date;
$date->set($customDateString, $customFormat);
echo $date->toString(Zend_Date::RFC_850) . PHP_EOL;
// Returns: Sunday, 02-Sep-12 13:11:00 America/Los_Angeles

When creating a date using any other timezone that matches /[:alpha:]\/[:alpha:]/ there is no issue.


Posted by Ralph Schindler (ralph) on 2013-04-05T16:07:24.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.