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
This commit is contained in:
rboren 2004-11-25 16:23:24 +00:00
parent aa2dd4d548
commit 03766d3f29
1 changed files with 6 additions and 3 deletions

View File

@ -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);