ZF-12432: Trying to clone a Zend_Date object but it returns a different date (and even time)

Issue Type: Bug Created: 2012-10-02T03:11:40.000+0000 Last Updated: 2013-04-05T16:07:15.000+0000 Status: Closed Fix version(s): Reporter: Prueba Prueba (prueba2306) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

  • getdate
  • zend_date

Related issues: Attachments:


I been coding some functions in a project that requires operations with dates. In one of the functions i got a problem with an operation and trying to figure it out what happened i found this issue.

When i create a Zend_Date object and try to clone it to perform some operations on the cloned object (and keep the original object "as is") i get a different date when i invoke "getDate" function. Here is an example:

<pre class="highlight">
$d = new Zend_Date('2012-04-01', 'yyyy-MM-dd');
echo $d . '; ' . $d->getDate();

$d displays "Apr 1, 2012 12:00:00 AM" but $d->getDate() displays "Apr 2, 2012 12:00:00 AM"

The issue is not all the time, in the next code the date part is cloned correctly (except the time part that is supposed to be 00:00:00):

<pre class="highlight">
$d = new Zend_Date('2012-04-23', 'yyyy-MM-dd');
echo $d . '; ' . $d->getDate();

$d displays "Apr 23, 2012 12:00:00 AM" but $d->getDate() displays "Apr 23, 2012 11:00:00 PM"

I though that the problem was the "date format" so i tried a different approach, but it still change the cloned date:

<pre class="highlight">
$d = Zend_Date::now();
echo $d . '; ' . $d->getDate()

$d displays "Jan 1, 2012 9:40:15 PM" but $d->getDate() displays "Jan 2, 2012 12:00:00 AM"

Any ideas?


Posted by Ralph Schindler (ralph) on 2013-04-05T16:07:15.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.