Tools.php
public static function getDateFromBirthNumber($no)
    {
        if (!preg_match('#^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$#', $no, $matches)) {
            return null;
        }

        list(, $year, $month, $day, $ext, $c) = $matches;

        if ($c === '') {
            $year += $year < 54 ? 1900 : 1800;
        } else {
            $mod = ($year . $month . $day . $ext) % 11;
            if ($mod === 10) {
                $mod = 0;
            }
            if ($mod !== (int)$c) {
                return null;
            }
            $year += $year < 54 ? 2000 : 1900;
        }
        if ($year > 2003) {
            if ($month > 70) {
                $month -= 70;
            }
            if ($month > 20 && $month < 50) {
                $month -= 20;
            }
        }
        if ($month > 50) {
            $month -= 50;
        }

        return new DateTime(sprintf('%04d-%02d-%02d', $year, $month, $day));
    }
public static function getDateFromBirthNumber($no)
    {
        if (!preg_match('#^\s*(\d\d)(\d\d)(\d\d)[ /]*(\d\d\d)(\d?)\s*$#', $no, $matches)) {
            return null;
        }

        list(, $year, $month, $day, $ext, $c) = $matches;

        if ($c === '') {
            $year += $year < 54 ? 1900 : 1800;
        } else {
            $mod = ($year . $month . $day . $ext) % 11;
            if ($mod === 10) {
                $mod = 0;
            }
            if ($mod !== (int)$c) {
                return null;
            }
            $year += $year < 54 ? 2000 : 1900;
        }
        if ($year > 2003) {
            if ($month > 70) {
                $month -= 70;
            }
            if ($month > 20 && $month < 50) {
                $month -= 20;
            }
        }
        if ($month > 50) {
            $month -= 50;
        }

        return new DateTime(sprintf('%04d-%02d-%02d', $year, $month, $day));
    }
Get birth date from the birth number

@param string $no Birth number
@return DateTime Birth date or null