PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Normalizing a Time

Normally, a time will be returned with a date, if the input contains both. If the proper format is not known, but the locale relevant to the user input is known, then getTime() should be used, because it uses the default time format for the selected locale.

Example 586. Normalize an unknown time

<?php
$locale 
= new Zend_Locale('de_AT');
if (
Zend_Locale_Format::getTime('13:44:42',
                                array(
'date_format' =>
                                          
Zend_Locale_Format::STANDARD,
                                      
'locale' => $locale)) {
    print 
"time";
} else {
    print 
"not a time";
}

Zend Framework