Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php
public static function isDateTimeFormatCode($pFormatCode)
    {
        if (strtolower($pFormatCode) === strtolower(NumberFormat::FORMAT_GENERAL)) {
            //    "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
            return false;
        }
        if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) {
            //    Scientific format
            return false;
        }

        // Switch on formatcode
        switch ($pFormatCode) {
            //    Explicitly defined date formats
            case NumberFormat::FORMAT_DATE_YYYYMMDD:
            case NumberFormat::FORMAT_DATE_YYYYMMDD2:
            case NumberFormat::FORMAT_DATE_DDMMYYYY:
            case NumberFormat::FORMAT_DATE_DMYSLASH:
            case NumberFormat::FORMAT_DATE_DMYMINUS:
            case NumberFormat::FORMAT_DATE_DMMINUS:
            case NumberFormat::FORMAT_DATE_MYMINUS:
            case NumberFormat::FORMAT_DATE_DATETIME:
            case NumberFormat::FORMAT_DATE_TIME1:
            case NumberFormat::FORMAT_DATE_TIME2:
            case NumberFormat::FORMAT_DATE_TIME3:
            case NumberFormat::FORMAT_DATE_TIME4:
            case NumberFormat::FORMAT_DATE_TIME5:
            case NumberFormat::FORMAT_DATE_TIME6:
            case NumberFormat::FORMAT_DATE_TIME7:
            case NumberFormat::FORMAT_DATE_TIME8:
            case NumberFormat::FORMAT_DATE_YYYYMMDDSLASH:
            case NumberFormat::FORMAT_DATE_XLSX14:
            case NumberFormat::FORMAT_DATE_XLSX15:
            case NumberFormat::FORMAT_DATE_XLSX16:
            case NumberFormat::FORMAT_DATE_XLSX17:
            case NumberFormat::FORMAT_DATE_XLSX22:
                return true;
        }

        //    Typically number, currency or accounting (or occasionally fraction) formats
        if ((substr($pFormatCode, 0, 1) == '_') || (substr($pFormatCode, 0, 2) == '0 ')) {
            return false;
        }
        // Try checking for any of the date formatting characters that don't appear within square braces
        if (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $pFormatCode)) {
            //    We might also have a format mask containing quoted strings...
            //        we don't want to test for any of our characters within the quoted blocks
            if (strpos($pFormatCode, '"') !== false) {
                $segMatcher = false;
                foreach (explode('"', $pFormatCode) as $subVal) {
                    //    Only test in alternate array entries (the non-quoted blocks)
                    if (($segMatcher = !$segMatcher) &&
                        (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $subVal))) {
                        return true;
                    }
                }

                return false;
            }

            return true;
        }

        // No date...
        return false;
    }
public static function isDateTimeFormatCode($pFormatCode)
    {
        if (strtolower($pFormatCode) === strtolower(NumberFormat::FORMAT_GENERAL)) {
            //    "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
            return false;
        }
        if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) {
            //    Scientific format
            return false;
        }

        // Switch on formatcode
        switch ($pFormatCode) {
            //    Explicitly defined date formats
            case NumberFormat::FORMAT_DATE_YYYYMMDD:
            case NumberFormat::FORMAT_DATE_YYYYMMDD2:
            case NumberFormat::FORMAT_DATE_DDMMYYYY:
            case NumberFormat::FORMAT_DATE_DMYSLASH:
            case NumberFormat::FORMAT_DATE_DMYMINUS:
            case NumberFormat::FORMAT_DATE_DMMINUS:
            case NumberFormat::FORMAT_DATE_MYMINUS:
            case NumberFormat::FORMAT_DATE_DATETIME:
            case NumberFormat::FORMAT_DATE_TIME1:
            case NumberFormat::FORMAT_DATE_TIME2:
            case NumberFormat::FORMAT_DATE_TIME3:
            case NumberFormat::FORMAT_DATE_TIME4:
            case NumberFormat::FORMAT_DATE_TIME5:
            case NumberFormat::FORMAT_DATE_TIME6:
            case NumberFormat::FORMAT_DATE_TIME7:
            case NumberFormat::FORMAT_DATE_TIME8:
            case NumberFormat::FORMAT_DATE_YYYYMMDDSLASH:
            case NumberFormat::FORMAT_DATE_XLSX14:
            case NumberFormat::FORMAT_DATE_XLSX15:
            case NumberFormat::FORMAT_DATE_XLSX16:
            case NumberFormat::FORMAT_DATE_XLSX17:
            case NumberFormat::FORMAT_DATE_XLSX22:
                return true;
        }

        //    Typically number, currency or accounting (or occasionally fraction) formats
        if ((substr($pFormatCode, 0, 1) == '_') || (substr($pFormatCode, 0, 2) == '0 ')) {
            return false;
        }
        // Try checking for any of the date formatting characters that don't appear within square braces
        if (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $pFormatCode)) {
            //    We might also have a format mask containing quoted strings...
            //        we don't want to test for any of our characters within the quoted blocks
            if (strpos($pFormatCode, '"') !== false) {
                $segMatcher = false;
                foreach (explode('"', $pFormatCode) as $subVal) {
                    //    Only test in alternate array entries (the non-quoted blocks)
                    if (($segMatcher = !$segMatcher) &&
                        (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $subVal))) {
                        return true;
                    }
                }

                return false;
            }

            return true;
        }

        // No date...
        return false;
    }
public static function isDateTimeFormatCode ( $ pFormatCode ) { if ( strtolower ( $ pFormatCode ) === strtolower ( NumberFormat :: FORMAT_GENERAL ) ) { //    "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check) return false ; } if ( preg_match ( '/[0#]E[+-]0/i' , $ pFormatCode ) ) { //    Scientific format return false ; } // Switch on formatcode switch ( $ pFormatCode ) { //    Explicitly defined date formats case NumberFormat :: FORMAT_DATE_YYYYMMDD : case NumberFormat :: FORMAT_DATE_YYYYMMDD2 : case NumberFormat :: FORMAT_DATE_DDMMYYYY : case NumberFormat :: FORMAT_DATE_DMYSLASH : case NumberFormat :: FORMAT_DATE_DMYMINUS : case NumberFormat :: FORMAT_DATE_DMMINUS : case NumberFormat :: FORMAT_DATE_MYMINUS : case NumberFormat :: FORMAT_DATE_DATETIME : case NumberFormat :: FORMAT_DATE_TIME1 : case NumberFormat :: FORMAT_DATE_TIME2 : case NumberFormat :: FORMAT_DATE_TIME3 : case NumberFormat :: FORMAT_DATE_TIME4 : case NumberFormat :: FORMAT_DATE_TIME5 : case NumberFormat :: FORMAT_DATE_TIME6 : case NumberFormat :: FORMAT_DATE_TIME7 : case NumberFormat :: FORMAT_DATE_TIME8 : case NumberFormat :: FORMAT_DATE_YYYYMMDDSLASH : case NumberFormat :: FORMAT_DATE_XLSX14 : case NumberFormat :: FORMAT_DATE_XLSX15 : case NumberFormat :: FORMAT_DATE_XLSX16 : case NumberFormat :: FORMAT_DATE_XLSX17 : case NumberFormat :: FORMAT_DATE_XLSX22 : return true ; } //    Typically number, currency or accounting (or occasionally fraction) formats if ( ( substr ( $ pFormatCode , 0 , 1 ) == '_' ) || ( substr ( $ pFormatCode , 0 , 2 ) == '0 ' ) ) { return false ; } // Try checking for any of the date formatting characters that don't appear within square braces if ( preg_match ( '/(^|\])[^\[]*[' . self :: $ possibleDateFormatCharacters . ']/i' , $ pFormatCode ) ) { //    We might also have a format mask containing quoted strings... //        we don't want to test for any of our characters within the quoted blocks if ( strpos ( $ pFormatCode , '"' ) !== false ) { $ segMatcher = false ; foreach ( explode ( '"' , $ pFormatCode ) as $ subVal ) { //    Only test in alternate array entries (the non-quoted blocks) if ( ( $ segMatcher = ! $ segMatcher ) && ( preg_match ( '/(^|\])[^\[]*[' . self :: $ possibleDateFormatCharacters . ']/i' , $ subVal ) ) ) { return true ; } } return false ; } return true ; } // No date... return false ; }
Is a given number format code a date/time?

@param string $pFormatCode

@return bool
Is a given number format code a date / time?