Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php IntlDateFormatter返回错误的日期_Php_Date - Fatal编程技术网

Php IntlDateFormatter返回错误的日期

Php IntlDateFormatter返回错误的日期,php,date,Php,Date,使用IntlDateFormatter类格式化特定日期时遇到问题。我使用了各种方法,但均无效,我当前的代码如下: $dataForma = new DateTime(date("Y-m-d H:i:s", 1451420082)); // output > $dataForma string(26) "2015-12-29 18:14:42.000000" $dateFormater = \IntlDateFormatter::create( 'pt_br', \IntlDateFor

使用IntlDateFormatter类格式化特定日期时遇到问题。我使用了各种方法,但均无效,我当前的代码如下:

$dataForma  = new DateTime(date("Y-m-d H:i:s", 1451420082));
// output > $dataForma string(26) "2015-12-29 18:14:42.000000"

$dateFormater = \IntlDateFormatter::create(
'pt_br',
\IntlDateFormatter::LONG,
\IntlDateFormatter::NONE,
'America/Sao_Paulo',
\IntlDateFormatter::GREGORIAN,
'Y.MM MMM.d');

$dateFormater->format($dataForma);
// output > string(14) "2016.12 dez.29"
我的代码配置如下:

date_default_timezone_set('America/Sao_Paulo');
setlocale(LC_ALL,"portuguese-brazil");
我该放弃什么