src/CfdiUtils/Utils/Rfc.php
public static function obtainDate(string $rfc): int
    {
        // rfc is multibyte
        $begin = (mb_strlen($rfc) === 12) ? 3 : 4;
        // strdate is not multibyte
        $strdate = strval(mb_substr($rfc, $begin, 6));
        $parts = str_split($strdate, 2);
        // year 2000 is leap year (%4 & %100 & %400)
        /** @var int|false $date phpstan does not know that mktime can return false */
        $date = mktime(0, 0, 0, (int) $parts[1], (int) $parts[2], (int) ('20' . $parts[0]));
        if (false === $date) {
            return 0;
        }
        if (date('ymd', $date) !== $strdate) {
            return 0;
        }
        return $date;
    }
public static function obtainDate(string $rfc): int
    {
        // rfc is multibyte
        $begin = (mb_strlen($rfc) === 12) ? 3 : 4;
        // strdate is not multibyte
        $strdate = strval(mb_substr($rfc, $begin, 6));
        $parts = str_split($strdate, 2);
        // year 2000 is leap year (%4 & %100 & %400)
        /** @var int|false $date phpstan does not know that mktime can return false */
        $date = mktime(0, 0, 0, (int) $parts[1], (int) $parts[2], (int) ('20' . $parts[0]));
        if (false === $date) {
            return 0;
        }
        if (date('ymd', $date) !== $strdate) {
            return 0;
        }
        return $date;
    }
public static function obtainDate ( string $ rfc ) : int { // rfc is multibyte $ begin = ( mb_strlen ( $ rfc ) === 12 ) ? 3 : 4 ; // strdate is not multibyte $ strdate = strval ( mb_substr ( $ rfc , $ begin , 6 ) ) ; $ parts = str_split ( $ strdate , 2 ) ; // year 2000 is leap year (%4 & %100 & %400) /** @var int|false $date phpstan does not know that mktime can return false */ $ date = mktime ( 0 , 0 , 0 , ( int ) $ parts [ 1 ] , ( int ) $ parts [ 2 ] , ( int ) ( '20' . $ parts [ 0 ] ) ) ; if ( false === $ date ) { return 0 ; } if ( date ( 'ymd' , $ date ) !== $ strdate ) { return 0 ; } return $ date ; }
The date is always from the year 2000 since RFC does not provide century and 000229 is valid.
Please, change this function on year 2100!

@param string $rfc
@return int
The date is always from the year 2000 since RFC does not provide century and 000229 is valid . Please change this function on year 2100!