From ff0f70bac89d40b8fa8c7429b8d6513069dcf11d Mon Sep 17 00:00:00 2001 From: boots Date: Tue, 20 Jun 2006 16:38:36 +0000 Subject: [PATCH] emulate %l in the date_format modifier on windows thanks to Gibberish from the forums for reporting this --- libs/plugins/modifier.date_format.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php index 523c144f..8266e9d7 100644 --- a/libs/plugins/modifier.date_format.php +++ b/libs/plugins/modifier.date_format.php @@ -31,9 +31,11 @@ require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); 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); + $hours = strftime('%I', $string); + $short_hours = ( $hours < 10 ) ? substr( $hours, -1) : $hours; + $_win_from = array ('%e', '%T', '%D', '%l'); + $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y', $short_hours); + $format = str_replace($_win_from, $_win_to, $format); } if($string != '') { return strftime($format, smarty_make_timestamp($string));