26 lines
521 B
PHP
26 lines
521 B
PHP
<?php
|
|
|
|
/**
|
|
* Smarty plugin.
|
|
*/
|
|
|
|
/**
|
|
* Smarty {format_datetime} function plugin.
|
|
*/
|
|
function smarty_modifier_format_datetime($string, $value = null)
|
|
{
|
|
if ($string == '-0001-11-30') {
|
|
return '00-00-0000';
|
|
} elseif ($string instanceof \DateTime) {
|
|
$datetime = $string;
|
|
} elseif (empty($string)) {
|
|
return '';
|
|
} else {
|
|
$datetime = new DateTime($string);
|
|
}
|
|
|
|
$format = Settings::getDateFormat().' '.Settings::getTimeFormat();
|
|
|
|
return $datetime->format($format);
|
|
}
|