<?php
//the dutch date
$dutch_date = "donderdag 27 maart 2014 00:30";
//split it in usable parts
$converted_date = array();
$pattern = "#(?P<day_of_the_week>\w+)\ (?P<day>\d+)\ (?P<month>\w+)\ (?P<year>\d+)\ (?P<hour>\d+):(?P<minute>\d+)#s";
preg_match($pattern,$dutch_date, $converted_date);
//create the empty date, we'll store our date in this variable in "D, d F Y H:i:s" format
$date = "";
//create the "D, "-part
$daymap = array("maandag" => "Mon", "dinsdag"=>"Tue", "woensdag"=>"Wed", "donderdag"=>"Thu",
"vrijdag"=>"Fri", "zaterdag"=>"Sat", "zondag"=>"Sun");
$date .= $daymap[$converted_date["day_of_the_week"].", ";
//create the "d " part
$date .= $converted_date["year"] . "-";
$datemap = array("januari"=>"01", "februari"=>"02", "maart"=>"03", "april"=>"04", "mei"=>"05", "juni"=>"06",
"juli"=>"07", "augustus"=>"08", "september"=>"09", "oktober"=>"10", "november"=>"11", "december"=>"12");
$date .= $datemap[$converted_date["month"]]. "-";
$date .= $converted_date["day"]. " ";
$date .= $converted_date["hour"] . ":";
$date .= $converted_date["minute"] .":00";
echo $date;
?>
- Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28, 5.4.0 - 5.4.27
- Parse error: syntax error, unexpected ';', expecting ']' in /in/tQPoA on line 14
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected ';', expecting ']' in /in/tQPoA on line 14
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `']'' in /in/tQPoA on line 14
Process exited with code 255.
preferences:
220.65 ms | 1386 KiB | 117 Q