From 03766d3f290e7cd3fb79a33004aa0831ac0617a7 Mon Sep 17 00:00:00 2001 From: rboren Date: Thu, 25 Nov 2004 16:23:24 +0000 Subject: [PATCH] Use weekday locale data in mysql2date. Bug 492. Patch by nbachiyski. git-svn-id: http://svn.automattic.com/wordpress/trunk@1882 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 86636785ef..2802b87a4c 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -16,7 +16,7 @@ function get_profile($field, $user = false) { } function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1) { - global $month, $weekday; + global $month, $weekday, $month_abbrev, $weekday_abbrev; $m = $mysqlstring; if (empty($m)) { return false; @@ -24,12 +24,15 @@ function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1 $i = mktime(substr($m,11,2),substr($m,14,2),substr($m,17,2),substr($m,5,2),substr($m,8,2),substr($m,0,4)); if (!empty($month) && !empty($weekday) && $use_b2configmonthsdays) { $datemonth = $month[date('m', $i)]; + $datemonth_abbrev = $month_abbrev[$datemonth]; $dateweekday = $weekday[date('w', $i)]; + $dateweekday_abbrev = $weekday_abbrev[$dateweekday]; $dateformatstring = ' '.$dateformatstring; - $dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit(substr($dateweekday, 0, 3)), $dateformatstring); + $dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit($dateweekday_abbrev), $dateformatstring); $dateformatstring = preg_replace("/([^\\\])F/", "\\1".backslashit($datemonth), $dateformatstring); $dateformatstring = preg_replace("/([^\\\])l/", "\\1".backslashit($dateweekday), $dateformatstring); - $dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit(substr($datemonth, 0, 3)), $dateformatstring); + $dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit($datemonth_abbrev), $dateformatstring); + $dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring)-1); } $j = @date($dateformatstring, $i);