0

Running below example from the documentation returns false for me (other examples in this page have the same issue). Is it a 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

It seems parse method need format parameter of IntlDateFormatter constructor.

Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173

2 Answers2

0

You may need to set pattern using setPattern that gets patterns as said here.

Hadi Sadeqi
  • 196
  • 1
  • 5
0

Had same problem here. In my case the php internationalization extension was not installed:

sudo apt-get install php5-intl