> For yesterday there is a simple checking function "isYesterday".
> For getting yesterday you would simply use "subDay(1)";

 I said yesterday because I made my experiences yesterday, but I wanted to
 obtain the current date.

> getDate does not clone.
> For cloning only a date part you have to use
> copyPart()

 Extract from the source code of the class :
    /**
     * Returns a clone of $this, with the time part set to 00:00:00.
     *
     * @param  string|Zend_Locale  $locale  OPTIONAL Locale for parsing
 input
     * @return Zend_Date
     */
    public function getDate($locale = null)
    {
        return $this->copyPart(Zend_Date::DATE_MEDIUM, $locale);
    }

 And in the copyPart method :

    public function copyPart($part, $locale = null)
    {
        $clone = clone $this;
        ...
    }

 I now that, as it is said in the comments, it isn't an exact clone because
 of "the time part set to 00:00:00", but it's still an object, partially
 cloned.

>> The return value ($candidate) should be a new date formatted with
>> Zend_Date::DATE_MEDIUM (as it is used in the getDate() method). Moreover,
>> in
>> the documentation, we could see :
>
> I dont get the point why you are using object, convert to string, convert
> to object and reverse to string.
> I think you have a problem in your code. As you have given us only some
> lines we can not see where your problem is related.

 I am sorry, I think I didn't use the corrects words. I don't convert the
 object to a string, I wanted to precise that the getDate method use the
 copyPart method with the Zend_Date::DATE_MEDIUM specification.

>> $this -> get(Zend_Date::YEAR)
>> I obtained the value 07 although  the same operation made on the $today
>> date
>> returned the value 2007.
>
> $today is a date object.
> As you have converted your string to a date string format MEDIUM you have
> a date like this.
> 20.03.07

 As I said, I didn't convert my objet to a string, my code is the following
:

 $today = new Fxc_Date_Public();
 $nextDay = $today -> getNextWorkingDate();

 public function getNextWorkingDate()
 {
    $candidate = clone $this; // instead of $this -> getDate() which must
 return a partial clone, according to the comments
    do
    {
        $candidate -> addDay(1);
    }while($candidate -> isPublic());

    return $candidate;
 }

 The isPublic() method return a boolean. 
-- 
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#a9749641
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to