I'm trying to pass a date parameter to a php file so it could insert it into a MySQL table. This is how the date is being transferred:
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss%20yyyy-MM-dd");
String currentDateandTime = sdf.format(new Date());
And this is the part in the php file that tuches the date:
$date = $_GET['dt'];
$dateFirst = substr($date, 0, 8);
$dateSecond = substr($date, 11, 10);
$dateComplete = $dateFirst . ' ' . $dateSecond;
$sql=mysql_query("INSERT INTO User
VALUES (NULL, '$uName', '$pass', '$mail', '$disName', 0, '$dateComplete')");
The date field in the table is dateTime. The procedure doesn't fall but the date in the table looks like this: "00:00:00 0000-00-00". Can someone please tell me what am I doing wrong? Thank you in advance!