mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
22352a0227
commit
0670b96c24
1 changed files with 7 additions and 5 deletions
|
@ -1184,12 +1184,14 @@ class Model extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = $this->getDataSource()->columns[$type]['format'];
|
|
||||||
$day = empty($date['Y']) ? null : $date['Y'] . '-' . $date['m'] . '-' . $date['d'] . ' ';
|
|
||||||
$hour = empty($date['H']) ? null : $date['H'] . ':' . $date['i'] . ':' . $date['s'];
|
|
||||||
$date = new DateTime($day . $hour);
|
|
||||||
if ($useNewDate && !empty($date)) {
|
if ($useNewDate && !empty($date)) {
|
||||||
return $date->format($format);
|
$format = $this->getDataSource()->columns[$type]['format'];
|
||||||
|
foreach (array('m', 'd', 'H', 'i', 's') as $index) {
|
||||||
|
if (isset($date[$index])) {
|
||||||
|
$date[$index] = sprintf('%02d', $date[$index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str_replace(array_keys($date), array_values($date), $format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
|
|
Loading…
Reference in a new issue