[fw-core] Getting the date format string

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

[fw-core] Getting the date format string

Nikolaos Dimopoulos
Greetings,

I am trying to get the date format string in PHP notation using Zend_Date
and Zend_Locale. I want the date to be locale aware so that the string that
is returned can be formatted accordingly. For instance the string returned
for en_US could be "M d y" whereas the el_GR could be "d M y".

I have tried

$_dateFormat = Zend_Locale::getTranslationList('date', $locale);

and that works well but it returns an array where the format is defined as a
Zend_Date string format and not a PHP one  - i.e. d MMM y which is not valid
for PHP (it will return AugAugAug for the MMM).

Any pointers are more than welcome.

Thanks!

The contents of this message may contain confidential or privileged
information and is intended solely for the recipient(s). Use or distribution
to and by any other party is not authorized. If you are not the intended
recipient, copying, distribution or use of the contents of this information
is prohibited.
Reply | Threaded
Open this post in threaded view
|

AW: [fw-core] Getting the date format string

Thomas Weidner
Zend_Locale returns the data from CLDR as is without any change.
And Zend_Date can handle both types.

But you can't feed php's native functions with CLDR informations because they dont understand ISO.
When using Zend_Locale to get your format you have to stay with Zend_Date or convert from ISO to GNU manually.

Thomas Weidner

Zend Framework Certified Engineer & I18N Team Leader
http://www.thomasweidner.com

-----Urspr√ľngliche Nachricht-----
Von: Nikolaos Dimopoulos [mailto:[hidden email]]
Gesendet: Mittwoch, 10. August 2011 17:33
An: Zend Core
Betreff: [fw-core] Getting the date format string

Greetings,

I am trying to get the date format string in PHP notation using Zend_Date and Zend_Locale. I want the date to be locale aware so that the string that is returned can be formatted accordingly. For instance the string returned for en_US could be "M d y" whereas the el_GR could be "d M y".

I have tried

$_dateFormat = Zend_Locale::getTranslationList('date', $locale);

and that works well but it returns an array where the format is defined as a Zend_Date string format and not a PHP one  - i.e. d MMM y which is not valid for PHP (it will return AugAugAug for the MMM).

Any pointers are more than welcome.

Thanks!

The contents of this message may contain confidential or privileged information and is intended solely for the recipient(s). Use or distribution to and by any other party is not authorized. If you are not the intended recipient, copying, distribution or use of the contents of this information is prohibited.


--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]