以阿拉伯语显示日期 [英] Display dates in Arabic

查看:60
本文介绍了以阿拉伯语显示日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

setlocale( LC_ALL,'ar' ); 
echo strftime( '%e %b, %Y', strtotime( '2011-10-25' ));

输出:

25 Sep, 2011

为什么不显示阿拉伯文日期?我是否错误地使用了 strftime?

Why is it not displaying the arabic date? Am I using strftime incorrectly?

推荐答案

AFAIK setlocale 实际上不会为您进行任何语言翻译,而是会影响格式和比较器功能等内容.如果你想要本地化,那么你可以尝试使用 IntlDateFormatter 这可能会给你你需要什么.

AFAIK setlocale won't actually do any language translation for you but rather affects things like the formatting and comparator functionality. If you want localisation then you could try using IntlDateFormatter which may give you what you need.

更新:你也可以试试 Zend_Date 按照这个问题中的建议,如果 PHP 5.3 不是不适合你.

Updated: You could also try Zend_Date as suggested in this question if PHP 5.3 isn't an option for you.

这篇关于以阿拉伯语显示日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆