Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $year = 2012;
- $month = 1;
- $inputDatePast = intval(sprintf('%4d%02d', $year, $month)); //201201
- $year = 2016; // if you read this after september 2016: add a few more years here ;)
- $month = 9;
- $inputDateFuture = intval(sprintf('%4d%02d', $year, $month)); //201609
- $prevMonth = intval(date('Ym', mktime(12, 0, 0, date('n')-1, 1, date('Y'))));
- $validator = new Zend_Validate_GreaterThan($prevMonth);
- $validator->isValid($inputDatePast); // false
- $validator->isValid($inputDateFuture); // true
- ?>
Add Comment
Please, Sign In to add comment