Issues

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:

Description

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">
date_default_timezone_set('Europe/London');
$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->setTimezone('America/Los_Angeles');
$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.

Comments

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: https://github.com/zendframework/zf1/issues/2

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts