Fix timezone problem
This commit is contained in:
parent
8cdbf08482
commit
603f7bb72e
2 changed files with 4 additions and 3 deletions
|
|
@ -43,6 +43,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$timestamp += 3600;
|
||||||
if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
|
if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
|
||||||
if (DS == '\\') {
|
if (DS == '\\') {
|
||||||
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
|
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ function smarty_make_timestamp($string)
|
||||||
{
|
{
|
||||||
if (empty($string)) {
|
if (empty($string)) {
|
||||||
// use "now":
|
// use "now":
|
||||||
return time();
|
return localtime();
|
||||||
} elseif ($string instanceof DateTime) {
|
} elseif ($string instanceof DateTime) {
|
||||||
return $string->getTimestamp();
|
return $string->getTimestamp();
|
||||||
} elseif (strlen($string) == 14 && ctype_digit($string)) {
|
} elseif (strlen($string) == 14 && ctype_digit($string)) {
|
||||||
|
|
@ -29,13 +29,13 @@ function smarty_make_timestamp($string)
|
||||||
substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4));
|
substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4));
|
||||||
} elseif (is_numeric($string)) {
|
} elseif (is_numeric($string)) {
|
||||||
// it is a numeric string, we handle it as timestamp
|
// it is a numeric string, we handle it as timestamp
|
||||||
return (int) $string;
|
return localtime($string);
|
||||||
} else {
|
} else {
|
||||||
// strtotime should handle it
|
// strtotime should handle it
|
||||||
$time = strtotime($string);
|
$time = strtotime($string);
|
||||||
if ($time == - 1 || $time === false) {
|
if ($time == - 1 || $time === false) {
|
||||||
// strtotime() was not able to parse $string, use "now":
|
// strtotime() was not able to parse $string, use "now":
|
||||||
return time();
|
return localtime();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $time;
|
return $time;
|
||||||
|
|
|
||||||
Reference in a new issue