Emulate %R in the date_format modifier on Windows

Thanks to Danilo Buerger
This commit is contained in:
boots
2007-01-10 16:25:23 +00:00
parent 92e4c7c7f4
commit aae3f2e702
2 changed files with 7 additions and 2 deletions

5
NEWS
View File

@@ -1,3 +1,8 @@
- emulate %R in the date_format modifier on windows (Danilo Buerger, boots)
Version 2.6.16 (Dec 1st, 2006)
-------------------------------
- fixed replacement bug in trimwhitespace output filter that was introduced
in the last release (Spuerhund, boots)

View File

@@ -33,8 +33,8 @@ function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date
if (substr(PHP_OS,0,3) == 'WIN') {
$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);
$_win_from = array ('%e', '%T', '%D', '%l', '%R');
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y', $short_hours, '%H:%M');
$format = str_replace($_win_from, $_win_to, $format);
}
if($string != '') {