views:

44

answers:

1

Hello !

I have a function that returns me a date string using Zend_Date.

$date = new Zend_Date();
$date->setOptions(array('format_type' => 'php'));
$date->setTimestamp($timestamp);
return $date->toString($format);

When I set $format to 'l, d F Y' I expect something like:

Środa, 13 stycznia 2010 (correct polish string what means Wedneseday, 13 january 2010) and it works good.

But when I open this page in a browser with locale set to english it returns me date string in english instead of polish that I want to see.

What and where should I set to get always polish date regardless of browser settings ?

+3  A: 

Pass the 3rd parameter to toString():

$a = Zend_Date::now();
$a->setOptions(array('format_type' => 'php'));
$a->toString('l, d F Y', null, 'pl'); // wtorek, 12 stycznia 2010
Emil Ivanov
or set that in Zend_Locale which is where Zend_Date takes the locale from.
Tomáš Fejfar