Freitag, 24. Juni 2011

PHP time confusion

PHP (5.3.5) seems only wanting English date format:
Few days ago, I wanted to convert German month names (Februar, März etc.) into time and it failed. Although
$>locale -a | grep de_DE
de_DE
de_DE@euro
de_DE.utf8

says de_DE is installed. Strange. See here:
<?php 
//print_r(localeconv());
setlocale(LC_ALL,"de_DE");
setlocale(LC_TIME,"de_DE");
//print_r(localeconv());
echo strtotime("01. October 2011")."\n";
echo strtotime("01. Dezember 2011")."\n";
// echo strtotime("01. Dezember 2011")."\n";
// echo strftime("%d %B %Y","01 Dezember 2011");
echo "\n";
// echo strftime("%B","Dezember");echo "\n";
//var_dump(date_parse("01 Dezember 2011")); ?>

What would you expect? That is what I'm get:
$>php test.php
1317420000


Right, German month names are not recognized anymore.

Keine Kommentare: