mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 20:04:27 +02:00
emulate %l in the date_format modifier on windows
thanks to Gibberish from the forums for reporting this
This commit is contained in:
@@ -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)
|
||||
{
|
||||
if (substr(PHP_OS,0,3) == 'WIN') {
|
||||
$_win_from = array ('%e', '%T', '%D');
|
||||
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y');
|
||||
$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 != '') {
|
||||
|
Reference in New Issue
Block a user