In my app library I have Input filter which uses Zend_Form (ZF 1.*)
class My_InputFilter extends Zend_Form
{
public function init()
{
$this->addElement(
'text', 'dateFrom', array(
'required' => true,
'filters' => array(
'dateTimeTotimeStamp'
),
'validators' => array(
array('date', false, array('format' => 'Y-m-d H:i:s'))
)
)
);
}
}
Then in my application I would like to get validated data in timestamp format:
$inputFilter = new My_InputFilter();
if (!$inputFilter->isValid($criteria)) {
throw new InvalidArgumentException(
$this->simplifyInputFilterErrorMessages($inputFilter->getMessages())
);
} else {
$validatedCriteria = $inputFilter->getValues(); // Array with my timestamp date
}
Where to implement 'dateTimeTotimeStamp' (example name) strtotime() filter to get validated and filtered date in UNIX timestamp format?