From 0e7ed499e0c9f2f5df3c26b982b9722fe83af906 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Jun 2018 18:00:58 +0000 Subject: [PATCH] Date/Time: Simplify `mysql_to_rfc3339()`. Erasing timezone with a regular expression is redundant, the date could be just formatted in the respective format instead. Props Rarst. Fixes #42542. git-svn-id: https://develop.svn.wordpress.org/trunk@43384 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index c94096e4c0..3c4a301298 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -5863,10 +5863,7 @@ function wp_post_preview_js() { * @return string Date formatted for ISO8601 without time zone. */ function mysql_to_rfc3339( $date_string ) { - $formatted = mysql2date( 'c', $date_string, false ); - - // Strip timezone information - return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted ); + return mysql2date( 'Y-m-d\TH:i:s', $date_string, false ); } /**