<?php
$dates = array(
'20.5.14',
'21.5.14',
'22.5.14',
'23.5.14',
'24.5.14',
'25.5.14',
'26.5.14',
'27.5.14',
'28.5.14',
'29.5.14',
'30.5.14',
'31.5.14',
);
foreach ($dates as $date_in) {
try {
$temp_date = new DateTime($date_in);
$date_out = $temp_date->format('Y-m-d');
} catch (Exception $e) {
$date_out = 'error';
}
printf('%1$ 12s => %2$s', $date_in, $date_out);
echo "\n";
}
preferences:
50.26 ms | 402 KiB | 5 Q