public function date($message = null, $format = null, $separator = '')
    {
        $this->setRule(__FUNCTION__, function($val, $args)
                       {

                           if (strlen(trim($val)) === 0) {
                               return TRUE;
                           }

                           try {
                               $dt = new \DateTime($val, new \DateTimeZone("UTC"));
                               return true;
                           } catch(\Exception $e) {
                               return false;
                           }

                       }, $message, array($format, $separator));
        return $this;
    }
public function date($message = null, $format = null, $separator = '')
    {
        $this->setRule(__FUNCTION__, function($val, $args)
                       {

                           if (strlen(trim($val)) === 0) {
                               return TRUE;
                           }

                           try {
                               $dt = new \DateTime($val, new \DateTimeZone("UTC"));
                               return true;
                           } catch(\Exception $e) {
                               return false;
                           }

                       }, $message, array($format, $separator));
        return $this;
    }
public function date ( $ message = null , $ format = null , $ separator = '' ) { $ this -> setRule ( __FUNCTION__ , function ( $ val , $ args ) { if ( strlen ( trim ( $ val ) ) === 0 ) { return TRUE ; } try { $ dt = new \ DateTime ( $ val , new \ DateTimeZone ( "UTC" ) ) ; return true ; } catch ( \ Exception $ e ) { return false ; } } , $ message , array ( $ format , $ separator ) ) ; return $ this ; }
Field has to be a valid date.

@param string $message
@return FormValidator
Field has to be a valid date .