如何在PHP中拆分不同的日期格式?

I have some dates like this :

  • 15 Décembre 2012
  • Du mardi 18 avril au jeudi 25 mai
  • Le 25, 26 et 27 Juin

Just examples in French.

My database looks like :

 CREATE TABLE DateTest(id_date int(11), date text, date_deb date, date_fin date);

I would like to insert my different dates regardless format of them. I can easily insert the first example, the second too, but concerning the first, I don't know..

It can have few separators (, or et), and when I get the number of the day (25 for the first), I don't have the month.

What I would do, is write several regular expressions for catching the different ways that these date periods can be entered. For the third format, for example:

$month_nrs = array('janvier' => 1, 'février' => 2, 'mars' => 3, 'avril' => 4, 'mai' => 5, 'juin' => 6, 'juillet' => 7, 'août' => 8, 'septembre' => 9, 'octobre' => 10, 'novembre' => 11, 'décembre' => 12);

$period = 'Le 25, 26 et 27 Juin';
//$period = 'Le 25 et 26 Juin';
//$period = 'Le 25, 26, 27 et 28 Juin';
if (preg_match('/(\d{1,2})(?:,\s*\d{1,2})* et (\d{1,2})\s+(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i', $period, $matches)) {
    $month_name = strtolower($matches[3]);
    $month_nr = $month_nrs[$month_name];
    $day_deb = $matches[1];
    $day_fin = $matches[2];
    $date_deb = date('Y').'-'.$month_nr.'-'.$day_deb;
    $date_fin = date('Y').'-'.$month_nr.'-'.$day_fin;

    echo "Date deb: $date_deb, date fin: $date_fin";
}