display date_format %e, %T and %D as expected for windows

This commit is contained in:
mohrt
2004-06-23 13:56:10 +00:00
parent ac2ccefdf1
commit b67e942fda

View File

@@ -29,6 +29,11 @@ require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
*/ */
function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null) function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
{ {
if (substr(PHP_OS,0,3) == 'WIN') {
$_win_from = array ('%e', '%T', '%D');
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y');
$format = str_replace($_win_from, $_win_to, $format);
}
if($string != '') { if($string != '') {
return strftime($format, smarty_make_timestamp($string)); return strftime($format, smarty_make_timestamp($string));
} elseif (isset($default_date) && $default_date != '') { } elseif (isset($default_date) && $default_date != '') {