1

可能重复:
将数字日期(03-11-1991)转换为阿拉伯数字(1991/11/03)php

这是我客户的要求。他想用普通数字显示今天的日期,也想用阿拉伯数字显示今天的日期。看这个屏幕截图

我可以通过以下代码片段轻松获取当前日期:

$current_date = date('d').'-'.date('m').'-'.date('Y');

但是我怎样才能将数字转换为阿拉伯数字并显示它们。?请建议好的方法来做到这一点。

4

1 回答 1

4

检查这个uk.php.net/manual/en/class.intldateformatter.php或者你可以使用下面的字符串替换功能

header('Content-Type: text/html; charset=utf-8');
$standard = array("0","1","2","3","4","5","6","7","8","9");
$eastern_arabic_symbols = array("٠","١","٢","٣","٤","٥","٦","٧","٨","٩");
$current_date = date('d').'-'.date('m').'-'.date('Y');
$arabic_date = str_replace($standard , $eastern_arabic_symbols , $current_date);
于 2012-11-06T07:23:15.743 回答