79 $format = preg_replace(
'/^(\[DBNum\d\])*(\[\$[^\]]*\])/i',
'', $format);
83 $format = preg_replace_callback(
'/(?:^|")([^"]*)(?:$|")/', [
'self',
'setLowercaseCallback'], $format);
86 $blocks = explode(
'"', $format);
87 foreach ($blocks as
$key => &$block) {
89 $block = strtr($block, self::$dateFormatReplacements);
90 if (!strpos($block,
'A')) {
93 if (
false !== strpos($block,
'[h]')) {
94 $hours = (int) ($value * 24);
95 $block = str_replace(
'[h]', $hours, $block);
99 $block = strtr($block, self::$dateFormatReplacements24);
102 $block = strtr($block, self::$dateFormatReplacements12);
106 $format = implode(
'"', $blocks);
109 $format = preg_replace_callback(
'/"(.*)"/U', [
'self',
'escapeQuotesCallback'], $format);
111 $dateObj = Date::excelToDateTimeObject($value);
115 $format = \preg_replace(
'/\\\\:m/',
':i', $format);
117 return $dateObj->format($format);
122 return mb_strtolower($matches[0]);
127 return '\\' . implode(
'\\', str_split($matches[1]));