2016-12-26 4 views
-1

Ich möchte cMonth in Spanisch Echo .. Ich habe verschiedene Dinge ohne Ergebnis versucht. irgendeine Idee?spanische Ausgabe für "Datum" Funktion

if($_REQUEST["month"]>0){ 
    $cMonth = "0".intval($_REQUEST["month"]); 
    if ($_REQUEST["month"]>9) { 
     $cMonth = intval($_REQUEST["month"]); 
    } 
    $cYear = intval($_REQUEST["year"]); 
}else 
{ 
    $cMonth = date("m"); 
    $cYear = date("Y"); 
} 

echo date("F, Y",strtotime($cYear."-".$cMonth."-01")); 
+0

Verwenden strftime (http://php.net/strftime) anstelle von "Datum" verwenden. Schauen Sie diese Antwort: http://stackoverflow.com/questions/4975854/translating-php-date-for-multiling-site – yivi

Antwort

1

Hallo können Sie diese Methode nur

setlocale(LC_ALL, "es_ES", 'Spanish_Spain', 'Spanish'); 
    $string = "27/12/2016"; 
    $date = \DateTime::createFromFormat("d/m/Y", $string); 
    echo strftime("%B", $date->getTimestamp()); 
+0

danke !! aber ich weiß nicht gut, wie integriert hier: datum ("F, Y", strtotime ($ cYear. "-". $ cMonth. "- 01")); – CosmicDisco

+0

Ich verstehe nicht, was das Problem ist –

+0

@ CosmicDisco, ich denke, Sie wollen in diesem Format "F, Y" sehen, aber mit strftime. Sie können [strftime documentation] (https://secure.php.net/manual/pt_BR/function.strftime.php) überprüfen. –