使用正确的语言输出php日期 [英] Output php date with the right language
问题描述
可能重复:
PHP日期函数输出意大利语
我尝试到FORCE本地更改并获取日期输出的值在法国...这不工作:
这里是代码
I try to FORCE local to change and get the value of date outputt in french... this dont work : here is the code
setlocale(LC_ALL, 'ca_FR');
echo date("l, F d, Y");
这里是服务器设置:PHP Version> = 5.2(5.2.16+ best)5.2.17和操作系统:Linux
here is the server setting : PHP Version >= 5.2 (5.2.16+ best) 5.2.17 and Operating System : Linux
我需要以法语输出日期:mercredi .....
I need to output the date in french as : mercredi.....
推荐答案
从手册:
要格式化其他语言的日期,您应该使用setlocale()和
strftime()函数而不是date()。 / p>
To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().
所以使用:
setlocale(LC_ALL, 'ca_FR');
echo strftime("%A, %e %B, %G");
备注:所选区域设置也必须安装在服务器上检查 ca_FR
是否是已安装的区域设置。很多linux系统有 fr_FR
或 fr_FR.utf8
作为法语区域设置
note: the selected locale must also be installed on the server, so check if ca_FR
is a installed locale. A lot of linux systems have fr_FR
or fr_FR.utf8
as french locale
这篇关于使用正确的语言输出php日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!