public static function PHPExcel_Shared_Date::isDateTimeFormatCode in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Date.php \PHPExcel_Shared_Date::isDateTimeFormatCode()
* Is a given number format code a date/time? * *
Parameters
string $pFormatCode: * @return boolean
3 calls to PHPExcel_Shared_Date::isDateTimeFormatCode()
- PHPExcel_Calculation_TextData::TEXTFORMAT in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ TextData.php - * TEXTFORMAT * *
- PHPExcel_Reader_Gnumeric::loadIntoExisting in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Gnumeric.php - * Loads PHPExcel from file into PHPExcel instance * *
- PHPExcel_Shared_Date::isDateTimeFormat in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ Date.php - * Is a given number format a date/time? * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ Date.php, line 282
Class
- PHPExcel_Shared_Date
- PHPExcel_Shared_Date
Code
public static function isDateTimeFormatCode($pFormatCode = '') {
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_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 PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYSLASH:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMYMINUS:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_DMMINUS:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_MYMINUS:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME1:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME2:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME5:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME6:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME7:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME8:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX14:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:
case PHPExcel_Style_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;
}