【问题标题】:The intl example does not work for me国际示例对我不起作用
【发布时间】:2014-07-26 03:46:17
【问题描述】:

documentation 运行下面的示例对我来说返回 false(此页面中的其他示例有相同的问题)。是bug吗?

$fmt = new IntlDateFormatter(
    'en_US',
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN
);
echo 'First parsed output is ' . $fmt->parse('Wednesday, December 20, 1989 4:00:00 PM PT');


echo $fmt->getErrorMessage(); // return: U_PARSE_ERROR

看来parse方法需要format参数IntlDateFormatter构造函数。

【问题讨论】:

    标签: php date calendar intl


    【解决方案1】:

    您可能需要使用setPattern 设置模式,以获取here 所说的模式。

    【讨论】:

      【解决方案2】:

      这里有同样的问题。 就我而言,未安装 php 国际化扩展:

      sudo apt-get install php5-intl

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-10-15
        • 2021-05-17
        • 2013-04-05
        • 2015-03-04
        • 2014-02-15
        • 1970-01-01
        相关资源
        最近更新 更多