Hi guys,
I have a filed where the user will enter a date in the UK format, i.e.
dd-mm-yyy or dd/mm/yyyy with most likely either -s and /s.
I want to convert this date into the sql format of a date
yyyy-mm-dd
I'm trying to do this using the substr function but it doesn't seem to work.
<?php
//convert the date from UK format into SQL friendly format.
$Delivery='28-10-1978';
echo("$Delivery<br><br>");
$year = substr($Delivery,6,9);
echo("$year<br><br>");
$month = substr($Delivery,3,4);
echo("$month<br><br>");
$day = substr($Delivery,0,1);
echo("$day<br><br>");
$Delivery=$year.'-'.$month.'-'.$day;
echo("$Delivery");
?>
Any ideas what is wrong with that code?