Reputation: 1015
I'm developing a zend form for a events. I wanna validate two dates such that the first one ($date_start
) should be greater than the current date and the second one ($date_end
) should be greater than the first one ($date_end > $date_start
). Does anybody knows how to do it using validators?
Upvotes: 1
Views: 4822
Reputation: 4254
Yes what @ArnieRie says is right .
But as you are looking to use in Zend_Form
You can check this question : Zend Form Validate Range Date
Same applies here. I saw the same article over http://www.oplabo.com/article/22 .
Upvotes: 1
Reputation: 20736
Easy with Zend Date
$dateOne = new Zend_Date(time());
$dateTwo = new Zend_Date(time());
if ($dateOne->isLater($dateTwo)) {
// do what ever
}
if ($dateOne->isEarlier($dateTwo)) {
// do what ever
}
Upvotes: 4