mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
display date_format %e, %T and %D as expected for windows
This commit is contained in:
@@ -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 != '') {
|
||||||
|
Reference in New Issue
Block a user