PHP date()以外语 - 例如Mar 25Aoû09 [英] PHP date() in foreign languages - e.g. Mar 25 Aoû 09

查看:102
本文介绍了PHP date()以外语 - 例如Mar 25Aoû09的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要向国际观众显示日期数据的脚本,例如

I have a script that needs to display date data to an international audience - e.g.


提交日期:25 Aug 09 p>

"submitted Tue 25 Aug 09"

有没有更简单/更清洁的方法来转换为法语(等)相当于Mar 25Aoû09:

Is there an easier/cleaner way to get this converted to the French(etc) equivalent "Mar 25 Aoû 09" than:

设置常量 LANG 和一个 $ LANGUAGES 包含文件数组&如果(LANG!='EN')
{
包含$ LANGUAGES ['LANG'],则

Setting a constant LANG and a $LANGUAGES array of include files & :

if(LANG != 'EN')
{
include $LANGUAGES['LANG'];
}

&那么所包含的文件会将日期&几个月替换适当的区域设置?

& then the included file maps the days & months & replaces for the appropriate locale?

感谢

David

推荐答案

我想你没有设置LOCALE就不能这样做:

I think you can't get away from doing so without setting LOCALE:

<?php
setlocale(LC_ALL, 'fr_FR');

echo strftime("%A %e %B %Y");
?> 

有关strftime的详细信息:
http://us2.php.net/manual/en/function.strftime.php

Some details on strftime: http://us2.php.net/manual/en/function.strftime.php

这篇关于PHP date()以外语 - 例如Mar 25Aoû09的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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