我第一次使用IntlDateFormatter/i18n。当我想用法语格式化日期时,我得到了正确的格式(dd/MM/yyyy),但当我寻找意大利格式(例如)时,我得到了错误的格式(dd/MM/yy),而不是与法语格式相同的格式。
这是IntlDateFormatter的bug吗?我做错了什么吗?下面是一个代码示例:
<?php
$fmt = new IntlDateFormatter('fr_FR', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
echo $fmt->getPattern(); // return dd/MM/yyyy
$fmt = new IntlDateFormatter('it_IT', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
echo $fmt->getPattern(); // return dd/MM/yy instead of dd/MM/yyyy这里是我获取信息的地方,for the date format in France and Italy和for the IntlDateFormatter patterns
发布于 2014-04-24 23:30:47
对于我使用php5.5和lib-icu 4.2.1,这两个国家都为我提供了dd/MM/yy,所以如果你想要一个不同的模式,我建议在上游创建一个数组,并使用你调用的setPattern。
我猜问题出在你系统里libicu的版本上,但我不能百分之百确定。
https://stackoverflow.com/questions/23272929
复制相似问题