Zend_Date locale aware

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Zend_Date locale aware

umpirsky
Hi.

I have locale stored in registry

Zend_Registry::set('Zend_Locale', new Zend_Locale('sr_RS'));

and I want to implement view helper to format dates, sth like:

class Umpirsky_View_Helper_Date extends Zend_View_Helper_Abstract {
    public function date($date) {
    $date = new Zend_Date($date);
        return $date->getDate()->__toString();
        }
}

But this outputs date with time part, like:
05.10.2009. 23.00.00
and I want only 05.10.2009 part. Date and time are localized, and that is ok, but I want just date part.

How can i do this?

Regards,
Sasa Stamenkovic.
Reply | Threaded
Open this post in threaded view
|

Re: Zend_Date locale aware

Thomas Weidner
Please read the manual carefully.
Especially the options for the toString() method. There is a complete
chapter which describes all 100 possible variants.

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

----- Original Message -----
From: "umpirsky" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, October 22, 2009 7:09 PM
Subject: [fw-i18n] Zend_Date locale aware


>
> Hi.
>
> I have locale stored in registry
>
> Zend_Registry::set('Zend_Locale', new Zend_Locale('sr_RS'));
>
> and I want to implement view helper to format dates, sth like:
>
> class Umpirsky_View_Helper_Date extends Zend_View_Helper_Abstract {
>    public function date($date) {
>    $date = new Zend_Date($date);
>        return $date->getDate()->__toString();
> }
> }
>
> But this outputs date with time part, like:
> 05.10.2009. 23.00.00
> and I want only 05.10.2009 part. Date and time are localized, and that is
> ok, but I want just date part.
>
> How can i do this?
>
> Regards,
> Sasa Stamenkovic.
> --
> View this message in context:
> http://www.nabble.com/Zend_Date-locale-aware-tp26013714p26013714.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Zend_Date locale aware

umpirsky
@Rocco Results with non localized date :(
@Matthew Thx will try.

Regards,
Saša Stamenković


On Thu, Oct 22, 2009 at 8:01 PM, Thomas Weidner <[hidden email]> wrote:
Please read the manual carefully.
Especially the options for the toString() method. There is a complete chapter which describes all 100 possible variants.

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

----- Original Message ----- From: "umpirsky" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, October 22, 2009 7:09 PM
Subject: [fw-i18n] Zend_Date locale aware




Hi.

I have locale stored in registry

Zend_Registry::set('Zend_Locale', new Zend_Locale('sr_RS'));

and I want to implement view helper to format dates, sth like:

class Umpirsky_View_Helper_Date extends Zend_View_Helper_Abstract {
  public function date($date) {
  $date = new Zend_Date($date);
      return $date->getDate()->__toString();
}
}

But this outputs date with time part, like:
05.10.2009. 23.00.00
and I want only 05.10.2009 part. Date and time are localized, and that is
ok, but I want just date part.

How can i do this?

Regards,
Sasa Stamenkovic.
--
View this message in context: http://www.nabble.com/Zend_Date-locale-aware-tp26013714p26013714.html
Sent from the Zend I18N/Locale mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Zend_Date locale aware

umpirsky
$date->getDate()->toString(Zend_Date::DATES) did the job!

Thanks to all again.

Will setting cache speedup this call?

Regards,
Saša Stamenković


On Thu, Oct 22, 2009 at 10:19 PM, Саша Стаменковић <[hidden email]> wrote:
@Rocco Results with non localized date :(
@Matthew Thx will try.

Regards,
Saša Stamenković



On Thu, Oct 22, 2009 at 8:01 PM, Thomas Weidner <[hidden email]> wrote:
Please read the manual carefully.
Especially the options for the toString() method. There is a complete chapter which describes all 100 possible variants.

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

----- Original Message ----- From: "umpirsky" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, October 22, 2009 7:09 PM
Subject: [fw-i18n] Zend_Date locale aware




Hi.

I have locale stored in registry

Zend_Registry::set('Zend_Locale', new Zend_Locale('sr_RS'));

and I want to implement view helper to format dates, sth like:

class Umpirsky_View_Helper_Date extends Zend_View_Helper_Abstract {
  public function date($date) {
  $date = new Zend_Date($date);
      return $date->getDate()->__toString();
}
}

But this outputs date with time part, like:
05.10.2009. 23.00.00
and I want only 05.10.2009 part. Date and time are localized, and that is
ok, but I want just date part.

How can i do this?

Regards,
Sasa Stamenkovic.
--
View this message in context: http://www.nabble.com/Zend_Date-locale-aware-tp26013714p26013714.html
Sent from the Zend I18N/Locale mailing list archive at Nabble.com.