From 92b7e672a41a8bef3116ab6a29bfb4c910d8aace Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Mon, 23 Feb 2004 05:36:57 +0000 Subject: [PATCH] fixed get_date_from_gmt() git-svn-id: https://develop.svn.wordpress.org/trunk@918 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions-formatting.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 5be488057d..716b637f33 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -393,10 +393,10 @@ function wp_iso_descrambler($string) { function get_gmt_from_date($string) { $time_difference = get_settings('time_difference'); // $string must be of the form 'yyyy-mm-dd hh:mm:ss' - if ($string != gmdate('Y-m-d H:i:s')) { + if ($string != gmdate('Y-m-d H:i:s', strtotime($string))) { $string_time = gmmktime(substr($string,11,13), substr($string,14,16), substr($string,17,19), substr($string,5,7), substr($string,8,10), substr($string,0,4)); $gmt_time = $string_time - $time_difference*3600; - return gmdate('Y-m-d H:i:s', $gmt_time); + return date('Y-m-d H:i:s', $gmt_time); } else { return $string; } @@ -406,10 +406,9 @@ function get_gmt_from_date($string) { function get_date_from_gmt($string) { $time_difference = get_settings('time_difference'); // $string must be of the form 'yyyy-mm-dd hh:mm:ss' - if ($string == gmdate('Y-m-d H:i:s')) { - $string_time = gmmktime(substr($string,11,13), substr($string,14,16), substr($string,17,19), substr($string,5,7), substr($string,8,10), substr($string,0,4)); - $local_time = $string_time + $time_difference*3600; - return gmdate('Y-m-d H:i:s', $local_time); + if ($string == gmdate('Y-m-d H:i:s', gmmktime(substr($string,11,13), substr($string,14,16), substr($string,17,19), substr($string,5,7), substr($string,8,10), substr($string,0,4)))) { + $local_time = strtotime($string) + $time_difference*3600; + return date('Y-m-d H:i:s', $local_time); } else { return $string; }