Hi,
I need a formatDate helper to use
in the views but I'm in trouble on which
way to turn.
To sum up in my bootstrap I've got

$zl = new Zend_Locale();
$zl->setLocale($locale);
Zend_Registry::set('Zend_Locale', $zl);
$currency = new Zend_Currency($locale);
Zend_Registry::set('Zend_Currency', $currency);
Zend_Registry::set('Zend_Translate', $translate);

when I insert a date 
 $date = new Zend_Date();
    // Output of the current timestamp
    $data['registration_datetime'] =  $date->toString('yyyy-MM-dd
HH:mm:ss');
    

but to show a date in the view I'm stuck on
(I mean for the code inside the helper)
I tried with 
$locale = new Zend_Locale('de_AT');
$date = Zend_Locale_Format::getDate('13.04.2006',
                                    array('date_format' =>
                                              Zend_Locale_Format::STANDARD,
                                          'locale' => $locale)
                                   );
 
print_r ($date);
it's the example and it works :)
but if I try
$locale = new Zend_Locale('en_US');
$date = Zend_Locale_Format::getDate('13.04.2006',
                                    array('date_format' =>
                                              Zend_Locale_Format::STANDARD,
                                          'locale' => $locale)
                                   );
 
print_r ($date);

I get a Zend_Locale_Exception 
the method need the right format depend on local
like
$locale = new Zend_Locale('en_US');
$date = Zend_Locale_Format::getDate('04.13.2006',
                                    array('date_format' =>
                                              Zend_Locale_Format::STANDARD,
                                          'locale' => $locale)
                                   );

print_r ($date);
May be I miss something ?
can you help me, please ?

Bye

The last doubt but the static method return an
array same trouble for the output

-- 
View this message in context: 
http://n4.nabble.com/Localization-Format-date-helper-tp1555937p1555937.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to