Also möchtest du aus der Eingabe
22.01.01 (= DD.MM.YY)
folgendes machen um das Datum in der DB zu speichern:
2001-01-22 (= YYYY-MM-DD)
Hier die Definition des Zielformates (MySQL DATE)
Zitat:
Mysql Doku
A type to store date information. Uses the "YYYY-MM-DD" syntax, but may
be updated with a number or a string.
Understands at least the following syntaxes: 'YY-MM-DD', 'YYYY-MM-DD',
and 'YYMMDD'. Range 0000-00-00 to 9999-12-31.
|
Hier die Funktion zum umwandeln;
PHP-Code:
function date_german2mysql($datum) {
list($tag, $monat, $jahr) = explode(".", $datum);
return sprintf("%04d-%02d-%02d", $jahr, $monat, $tag);
}
Hoffe das hilft
Gruß, Paul