Output formatted dates using Zend_Date

View: New views
5 Messages — Rating Filter:   Alert me  

Output formatted dates using Zend_Date

by troxy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I'm wondering about how to output formatted dates using Zend_Date.
Let's say I have a Zend_Db_Table_Rowset with a date column stored as unix timestamps.
Now I want to iterate over this rowset and output the date as "EEEE dd MMMM yyyy".
What's the best way to achieve this?
Thank you,
--Emil

Re: Output formatted dates using Zend_Date

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For output just do:

$date = new Zend_Date($column);
$date->toString('EEEE dd MMMM yyyy');

Simple, isn't it ? ;-)

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message -----
From: "troxy" <emil@...>
To: <fw-i18n@...>
Sent: Sunday, January 27, 2008 5:55 PM
Subject: [fw-i18n] Output formatted dates using Zend_Date


>
> Hello,
>
> I'm wondering about how to output formatted dates using Zend_Date.
>
> Let's say I have a Zend_Db_Table_Rowset with a date column stored as unix
> timestamps.
>
> Now I want to iterate over this rowset and output the date as "EEEE dd
> MMMM
> yyyy".
>
> What's the best way to achieve this?
>
> Thank you,
>
> --Emil
> --
> View this message in context:
> http://www.nabble.com/Output-formatted-dates-using-Zend_Date-tp15121106s16154p15121106.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
>


Re: Output formatted dates using Zend_Date

by troxy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, thanks for your reply.
Do I really need to instance Zend_Date on every iteration?
In my view script this doesn't look so good:

<ul>
<?php foreach ($this->events as $event)?>
   <li><?php $date = new Zend_Date($event->dtstart); echo $date->toString('EEEE dd MMMM yyyy');?></li>
<?php endforeach;?>
</ul>

I think Zend_Date is missing something, like a static formatting function:

Zend_Date::format($foo, 'EEEE dd MMMM yyyy');

Thomas Weidner-2 wrote:
For output just do:

$date = new Zend_Date($column);
$date->toString('EEEE dd MMMM yyyy');

Simple, isn't it ? ;-)

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message -----
From: "troxy" <emil@troxy.net>
To: <fw-i18n@lists.zend.com>
Sent: Sunday, January 27, 2008 5:55 PM
Subject: [fw-i18n] Output formatted dates using Zend_Date


>
> Hello,
>
> I'm wondering about how to output formatted dates using Zend_Date.
>
> Let's say I have a Zend_Db_Table_Rowset with a date column stored as unix
> timestamps.
>
> Now I want to iterate over this rowset and output the date as "EEEE dd
> MMMM
> yyyy".
>
> What's the best way to achieve this?
>
> Thank you,
>
> --Emil
> --
> View this message in context:
> http://www.nabble.com/Output-formatted-dates-using-Zend_Date-tp15121106s16154p15121106.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
>

Re: Output formatted dates using Zend_Date

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just set() the new date...

And static formatting would not work with Zend_Date... but you can use
Zend_Locale_Format instead.

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message -----
From: "troxy" <emil@...>
To: <fw-i18n@...>
Sent: Wednesday, January 30, 2008 1:22 AM
Subject: Re: [fw-i18n] Output formatted dates using Zend_Date


>
> Hello, thanks for your reply.
> Do I really need to instance Zend_Date on every iteration?
> In my view script this doesn't look so good:
>
> <ul>
> <?php foreach ($this->events as $event)?>
>   <li><?php $date = new Zend_Date($event->dtstart); echo
> $date->toString('EEEE dd MMMM yyyy');?></li>
> <?php endforeach;?>
> </ul>
>
> I think Zend_Date is missing something, like a static formatting function:
>
> Zend_Date::format($foo, 'EEEE dd MMMM yyyy');
>
>
> Thomas Weidner-2 wrote:
>>
>> For output just do:
>>
>> $date = new Zend_Date($column);
>> $date->toString('EEEE dd MMMM yyyy');
>>
>> Simple, isn't it ? ;-)
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader
>> http://www.thomasweidner.com
>>
>> ----- Original Message -----
>> From: "troxy" <emil@...>
>> To: <fw-i18n@...>
>> Sent: Sunday, January 27, 2008 5:55 PM
>> Subject: [fw-i18n] Output formatted dates using Zend_Date
>>
>>
>>>
>>> Hello,
>>>
>>> I'm wondering about how to output formatted dates using Zend_Date.
>>>
>>> Let's say I have a Zend_Db_Table_Rowset with a date column stored as
>>> unix
>>> timestamps.
>>>
>>> Now I want to iterate over this rowset and output the date as "EEEE dd
>>> MMMM
>>> yyyy".
>>>
>>> What's the best way to achieve this?
>>>
>>> Thank you,
>>>
>>> --Emil
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Output-formatted-dates-using-Zend_Date-tp15121106s16154p15121106.html
>>> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Output-formatted-dates-using-Zend_Date-tp15121106s16154p15172746.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.


Re: Output formatted dates using Zend_Date

by troxy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
maby I should write my own view helper to do the work.
Thank you.
--Emil

Thomas Weidner-2 wrote:
Just set() the new date...

And static formatting would not work with Zend_Date... but you can use
Zend_Locale_Format instead.

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message -----
From: "troxy" <emil@troxy.net>
To: <fw-i18n@lists.zend.com>
Sent: Wednesday, January 30, 2008 1:22 AM
Subject: Re: [fw-i18n] Output formatted dates using Zend_Date


>
> Hello, thanks for your reply.
> Do I really need to instance Zend_Date on every iteration?
> In my view script this doesn't look so good:
>
> <ul>
> <?php foreach ($this->events as $event)?>
>   <li><?php $date = new Zend_Date($event->dtstart); echo
> $date->toString('EEEE dd MMMM yyyy');?></li>
> <?php endforeach;?>
> </ul>
>
> I think Zend_Date is missing something, like a static formatting function:
>
> Zend_Date::format($foo, 'EEEE dd MMMM yyyy');
>
>
> Thomas Weidner-2 wrote:
>>
>> For output just do:
>>
>> $date = new Zend_Date($column);
>> $date->toString('EEEE dd MMMM yyyy');
>>
>> Simple, isn't it ? ;-)
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader
>> http://www.thomasweidner.com
>>
>> ----- Original Message -----
>> From: "troxy" <emil@troxy.net>
>> To: <fw-i18n@lists.zend.com>
>> Sent: Sunday, January 27, 2008 5:55 PM
>> Subject: [fw-i18n] Output formatted dates using Zend_Date
>>
>>
>>>
>>> Hello,
>>>
>>> I'm wondering about how to output formatted dates using Zend_Date.
>>>
>>> Let's say I have a Zend_Db_Table_Rowset with a date column stored as
>>> unix
>>> timestamps.
>>>
>>> Now I want to iterate over this rowset and output the date as "EEEE dd
>>> MMMM
>>> yyyy".
>>>
>>> What's the best way to achieve this?
>>>
>>> Thank you,
>>>
>>> --Emil
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Output-formatted-dates-using-Zend_Date-tp15121106s16154p15121106.html
>>> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Output-formatted-dates-using-Zend_Date-tp15121106s16154p15172746.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
LightInTheBox - Buy quality products at wholesale price