--- formatting.php	2012-04-09 20:42:10.000000000 +0100
+++ formatting.20398.php	2012-04-09 20:46:03.000000000 +0100
@@ -1669,8 +1669,10 @@
 /**
  * Converts a GMT date into the correct format for the blog.
  *
- * Requires and returns in the Y-m-d H:i:s format. Simply adds the value of
- * gmt_offset.Return format can be overridden using the $format parameter
+ * Requires and returns a date in the Y-m-d H:i:s format. Simply adds the value
+ * of the 'gmt_offset' option. Return format can be overridden using the $format
+ * parameter. The DateTime and DateTimeZone classes are used to respect time
+ * zone differences in DST.
  *
  * @since 1.2.0
  *
@@ -1679,9 +1681,17 @@
  * @return string Formatted date relative to the GMT offset.
  */
 function get_date_from_gmt($string, $format = 'Y-m-d H:i:s') {
-    preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
-    $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
-    $string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600);
+    $tz = get_option('timezone_string');
+    if ( $tz ) {
+        date_default_timezone_set('UTC');
+        $datetime = new DateTime( $string );
+        $datetime->setTimezone( new DateTimeZone($tz) );
+        $string_localtime = $datetime->format($format);
+    } else {
+        preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
+        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
+        $string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600);
+    }
     return $string_localtime;
 }
 
