0
Symfony 2在自己的DateTimeToLocalizedStringTransformer 中使用了intlDateFormatter,但無法正常工作。intlDateFormatter夏令時
$tz = new DateTimeZone('Europe/Moscow');
$date = new DateTime('1 march', $tz);
echo "PHP: " . phpversion() . "<br/>\n";
echo "Intl: " . phpversion('intl') . "<br/>\n";
echo "<br/>\n";
echo "TZ: " . $tz->getName() . "<br/>\n";
echo "Native:<br/>\n";
echo $date->format('H:i:s d.m.Y');
echo "<br/>\n";
echo "Intl:<br/>\n";
$formatter = new IntlDateFormatter('RU_ru', IntlDateFormatter::FULL, IntlDateFormatter::FULL, $tz->getName());
echo $formatter->format($date);
echo "\n";
我有結果
PHP: 5.3.22-1~dotdeb.0
Intl: PECL-2.0.1
TZ: Europe/Moscow
Native:
00:00:00 01.03.2013
Intl:
28 february 2013 23:00:00
我嘗試
pecl install timezonedb
pecl install intl
,並重新安裝libicu44
因此,我如何更新ICU數據? 是這樣的? http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data 或簡單的重新安裝libicu最新版本? libicu48例如 – versh23 2013-03-09 08:58:32
@ user1747168您可以遵循該過程,但要注意的是,如果您的軟件包管理器管理libicu,則可能會在更新時重寫數據。如果您想更新ICU,則必須重新編譯PHP intl擴展(例如,通過重新安裝pecl)。 – Artefacto 2013-03-09 15:55:40