The only way to identify a date/time value in a cell is to look at the number format mask.
Function taken almost exactly from PHPExcel:
function isDateTimeFormatCode($pFormatCode = '') {
// General contains an epoch letter 'e', so we trap for it explicitly here
if (strtolower($pFormatCode) === 'general')
return FALSE;
// 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('/(^|\])[^\[]*[eymdHs]/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('/(^|\])[^\[]*[eymdHs]/i',$subVal))) {
return TRUE;
}
}
return FALSE;
}
return TRUE;
}
// No date...
return FALSE;
}