Sorry - just read the post properly and my answer wasn't your solution, but it can be adapted. The key is to write a function and within that compare $check['dob'] with today's date.
Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 22 Jun 2010, at 12:12, Jeremy Burns | Class Outfit wrote: > Add this to your model validation (assuming the field you are checking is > called 'dob'): > > > 'dob' => array( > 'inRange' => array( > 'rule' => 'isAgeInAcceptedRange', > 'message' => 'You must be between the ages of 18 and 80.' > ) > ), > > > Then add this function to your model: > > function isAgeInAcceptedRange($check) { > > list($Y,$m,$d) = explode("-", $check['dob']); > > $userAge = ( date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y ); > > if ( ($userAge >= 18) && ($userAge <= 80) ): > return true; > else: > return false; > endif; > > } > > > Jeremy Burns > Class Outfit > > [email protected] > http://www.classoutfit.com > > On 22 Jun 2010, at 10:16, jerry wrote: > >> I have been using cakephp for a few weeks now but i have failed to >> know how to validate a date for example a birthday to make sure it's >> now greater than the current date.Could anyone point me to the right >> direction >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] For more options, visit this group at >> http://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
