PHP Parsing of German Date
<p>I have a question about my code below. How can I format a German Date, for example "Di, 02.Okt 2012" to "2012-10-02"?</p>

<p>I already checked many sites for a solution but did not found something which could help me.</p>

<pre><code>    $value ='Di, 02.Okt 2012';
    $tempdate = $value;
    $tempdate = substr($tempdate,-11);
    $tempdate = date('Y-m-d',$tempdate);
</code></pre>

<p>Output: 1970-01-01</p>

<p>Solved:</p>

<pre><code>$value = 'comes from a foreach loop'; 

$tempdate = $value;
    $tempdate = substr($tempdate,-11);
    $tempdate = str_replace('.Jan ', '-01-', $tempdate);
    $tempdate = str_replace('.Feb ', '-02-', $tempdate);
    $tempdate = str_replace('.Mär ', '-03-', $tempdate);
    $tempdate = str_replace('.Apr ', '-04-', $tempdate);
    $tempdate = str_replace('.Mai ', '-05-', $tempdate);
    $tempdate = str_replace('.Jun ', '-06-', $tempdate);
    $tempdate = str_replace('.Jul ', '-07-', $tempdate);
    $tempdate = str_replace('.Aug ', '-08-', $tempdate);
    $tempdate = str_replace('.Sep ', '-09-', $tempdate);
    $tempdate = str_replace('.Okt ', '-10-', $tempdate);
    $tempdate = str_replace('.Nov ', '-11-', $tempdate);
    $tempdate = str_replace('.Dez ', '-12-', $tempdate);
    $tempdate = date('Y-m-d',strtotime($tempdate));

    echo $tempdate.'&lt;br/&gt;';
</code></pre>

<p>This is the solution for many Dates. ^^ i hope i can help with it</p>