1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.
    Dismiss Notice

Check age from DoB in PHP

Aug 11, 2013
Check age from DoB in PHP
  • To check someone's age from their date of birth:

    $app = JFactory::getApplication();
    $date= $app->input->getString('tablename___dateelement');
    $date = strtotime($date);
    $now = time();
    $diff = $now - $date;
    $years = floor($diff / 31556926);
    return ($years >= 18 && $years <= 90);