Get day from string in spanish PHP

前端 未结 4 920
臣服心动
臣服心动 2020-12-31 07:45

I\'m trying with:

 setlocale(LC_ALL,\"es_ES\");
 $string = \"24/11/2014\";
 $date = DateTime::createFromFormat(\"d/m/Y\", $string);
 echo $date->format(\"         


        
4条回答
  •  萌比男神i
    2020-12-31 08:19

    From the DateTime format page:

    This method does not use locales. All output is in English.

    If you need locales look into strftime Example:

    setlocale(LC_ALL,"es_ES");
    $string = "24/11/2014";
    $date = DateTime::createFromFormat("d/m/Y", $string);
    echo strftime("%A",$date->getTimestamp());
    

提交回复
热议问题