可能重复:
Convert numeral date(03-11-1991) into arabic no(۱۹۹۱/۱۱/۰۳) php
这是我客户的要求。他希望以正常数字显示今天的日期,并在阿拉伯数字中显示。 see this screen shot
我可以通过以下代码段轻松获取当前日期:
$current_date = date('d').'-'.date('m').'-'.date('Y');
但我怎么能将数字转换为阿拉伯数字并显示它们。 请提供良好的方法来做到这一点。
答案 0 :(得分: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);