emulate %l in the date_format modifier on windows

thanks to Gibberish from the forums for reporting this
This commit is contained in:
boots
2006-06-20 16:38:36 +00:00
parent 5f26404987
commit ff0f70bac8

View File

@@ -31,8 +31,10 @@ 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') { if (substr(PHP_OS,0,3) == 'WIN') {
$_win_from = array ('%e', '%T', '%D'); $hours = strftime('%I', $string);
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y'); $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); $format = str_replace($_win_from, $_win_to, $format);
} }
if($string != '') { if($string != '') {