On Sat, Apr 17, 2010 at 1:46 PM, Jurian Sluiman
<[email protected]> wrote:
> On Saturday 17 Apr 2010 13:40:43 András Csányi wrote:
>> Hi all!
>>
>> I want to know what is the date of the first day of the week. I did this:
>> $currDate = new Zend_Date();
>>     $currDate->sub($currDate->get(Zend_Date::WEEKDAY_DIGIT)-
>> 1,Zend_Date::DAY); var_dump($currDate->get('Y-m-d'));
>>
>> But, the result is not so good. The year and the day is good. The
>> month is replaced to minutes.
>> 2010-38-12; actual time here: 13:38
>>
>> I watched in the documentation and it should be good.
>> (http://hu.php.net/manual/en/function.date.php)
>>
>> If I get the date through __toString() good, but I want to avoid
>> formatting the string.
>>
>> Did I somethign wrong?
>>
>> Thanks for the help!
>
> No its' not a bug, you're using the minute constant. A capital M is the
> constant for the month.
>
> The Zend_Date constants differ from the php constants. Visit the documentation
> for more information:
> http://framework.zend.com/manual/en/zend.date.constants.html and specific the
> section "Self-Defined OUTPUT Formats with ISO"
>
> Regards, Jurian

The easiest way is still to do the following:
Zend_Date::setOptions(array('format_type' => 'php'));

... and then use PHP-like identifiers to do your date juggling.

Till

Reply via email to