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

Testing Times

Use checkDateFormat() to check if a given string contains a proper time. The usage is exact the same as with checking Dates, only date_format should contain the parts which you expect to have.

Example 587. Testing a time

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

Zend Framework