我尝试使用 2038 年之后的本地化日期和 php
strftime 使用时间戳,所以它在 2038 年之后不起作用
DateTime 未本地化...
所以我尝试将 IntlDateFormatter 与 DateTime 一起使用:
$d = DateTime::createFromFormat('Y-m-d', '2040-01-01');
$fmt = new IntlDateFormatter(
'fr_FR',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo $fmt->format($d);
echo $fmt->getErrorMessage();
我在这里得到: datefmt_format:无法获取时间戳:U_ILLEGAL_ARGUMENT_ERROR
其实我猜 IntlDateFormatter 在内部将日期转换为时间戳......
那么我如何在 php 中本地化超过 2038 的日期?