if (ereg ("([0-9]{4}) -([0-9]{1,2}) -([0-9]{1,2})", $date, $regs)) {echo "$regs[3].$regs[2].$regs[1]";} else {echo "Invalid date format: $date";}
The following code snippet takes a date in ISO format (YYYY-MM-DD) and prints it in DD.MM.YYYY format: