From 70e0de6054dc8cd90902c1cca2877294a1d0a186 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Mon, 23 Feb 2004 03:04:55 +0000 Subject: [PATCH] added get_gmt_from_date() git-svn-id: https://develop.svn.wordpress.org/trunk@913 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions-formatting.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 82b54f4ab7..62f9696fcb 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -377,7 +377,6 @@ function strip_all_but_one_link($text, $mylink) { // used by wp-mail to handle charsets in email subjects - function wp_iso_descrambler($string) { /* this may only work with iso-8859-1, I'm afraid */ if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) { @@ -389,4 +388,18 @@ function wp_iso_descrambler($string) { } } + +// give it a date, it will give you the same date as GMT +function get_gmt_from_date($string) { + global $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)); + $gmt_time = $string_time - $time_difference*3600; + return gmdate('Y-m-d H:i:s', $gmt_time); + } else { + return $string; + } +} + ?> \ No newline at end of file