In fact, I declared a Fxc_Date_Public object, representing yesterday by:
$today = new Fxc_Date_Public();

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

Next, I wanted to clone this one in one of its methods, by using the
getDate() method :

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

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.

$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

Then you converted your date back to a date object.
But how should the function know that you want 07 to be a short year when you say it's a full year ???
You should eighter keep working with objects and not convert to string.
Or you create your object with the proper format DATE_MEDIUM in this case.

To solve it, I used the operator clone instead of :
$candidate = $this -> getDate();

but I think it would be better if I could obtain the same result (with a
time part set to 00:00:00 so) with the getDate() method.

Just use copyPart(Zend_Date::DATE_MEDIUM) !!!
or any other format you expect to be copied.

Greetings
Thomas
I18N Team Leader

Reply via email to