使用正确的语言输出php日期

编程入门 行业动态 更新时间:2024-10-25 11:21:15
本文介绍了使用正确的语言输出php日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可能重复: 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日期

本文发布于:2023-10-23 00:03:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519134.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:正确   日期   语言   php

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!