Ok ...
As I said in my first message, I use the method get(Zend_Date::YEAR) on the
resulting date in order to call a PHP's native function with the year of the
date.
The code sample I gave you was just here to show you that I didn't transform
my object into a string.
In fact, after retrieving my new date with the method getNextWorkingDate(),
I did what I said : calling a function with its year.
For example, just try this :
<?php
require_once 'Zend/Date.php';
class Fxc_Date_Public extends Zend_Date {
public function getNextWorkingDate()
{
//$candidate = clone $this; // instead of $this -> getDate() which must
return a partial clone, according to the comments
$candidate = $this->getDate(); // Tried this line also but works the
same way, no difference
$candidate -> addDay(1);
return $candidate;
}
}
$today = new Fxc_Date_Public();
print "<br>".$today->get(Zend_Date::ISO_8601);
print "<br>".$today->get(Zend_Date::YEAR);
easter_date($today->get(Zend_Date::YEAR)); //do nothing interesting but pass
$nextDay = $today -> getNextWorkingDate();
print "<br>".$nextDay->get(Zend_Date::ISO_8601);
print "<br>".$nextDay->get(Zend_Date::YEAR);
easter_date($nextDay->get(Zend_Date::YEAR)); // do nothing interesting but
fails and outputs a warning
Even in your exemple, you can see that the get() method called on the $today
var returns 2007, whereas the same method called on the $nextDay var returns
7
Whatever, this exemple will show you explicitly the problem by outputting a
warning, because of the retrieve year, which is so 7 and not 2007.
--
View this message in context:
http://www.nabble.com/Zend_Date%3A%3AgetDate%28%29-doesn%27t-seem-to-return-a-clone-in-the-DATE_MEDIUM-format-tf3490792s16154.html#a9751378
Sent from the Zend Framework mailing list archive at Nabble.com.