kernel/lib/Date.php
public static function getAgeByDate(string $sBirthday) : int
    {
        list($iYear, $iMonth, $iDay) = preg_split('/[-.]/', $sBirthday);

        $aToday = array();
        $aToday['mois'] = date('n');
        $aToday['jour'] = date('j');
        $aToday['annee'] = date('Y');

        $iYears = $aToday['annee'] - $iYear;

        if ($aToday['mois'] <= $iMonth) {

            if ($iMonth == $aToday['mois']) {

                if ($iDay > $aToday['jour']) { $iYears--; }
            }
            else {

                $iYears--;
            }
        }

        return $iYears;
    }
public static function getAgeByDate(string $sBirthday) : int
    {
        list($iYear, $iMonth, $iDay) = preg_split('/[-.]/', $sBirthday);

        $aToday = array();
        $aToday['mois'] = date('n');
        $aToday['jour'] = date('j');
        $aToday['annee'] = date('Y');

        $iYears = $aToday['annee'] - $iYear;

        if ($aToday['mois'] <= $iMonth) {

            if ($iMonth == $aToday['mois']) {

                if ($iDay > $aToday['jour']) { $iYears--; }
            }
            else {

                $iYears--;
            }
        }

        return $iYears;
    }
public static function getAgeByDate ( string $ sBirthday ) : int { list ( $ iYear , $ iMonth , $ iDay ) = preg_split ( '/[-.]/' , $ sBirthday ) ; $ aToday = array ( ) ; $ aToday [ 'mois' ] = date ( 'n' ) ; $ aToday [ 'jour' ] = date ( 'j' ) ; $ aToday [ 'annee' ] = date ( 'Y' ) ; $ iYears = $ aToday [ 'annee' ] - $ iYear ; if ( $ aToday [ 'mois' ] <= $ iMonth ) { if ( $ iMonth == $ aToday [ 'mois' ] ) { if ( $ iDay > $ aToday [ 'jour' ] ) { $ iYears -- ; } } else { $ iYears -- ; } } return $ iYears ; }
get age by date

@access public
@param string $sBirthday
@return int
get age by date