I use ajax procedure for passing variables:
var a = 01;
var b = 2;
var c = 2016;
On php side I need to create this date - 01-Feb-2016 - and update a datetime column in mysql database. Here is an example of that column conntent - 2016-12-09 00:00:00
target.php
extract($_POST);
$date=date_create($c . '-' . $b . '-' . $a);
echo date_format($date, "Y-M-d"); // first try
$date = date("Y-M-d", $date); // second try
echo $date;
In both cases I'm getting errors.
Any help?
extract($_POST). That is extremely dangerous as you're allowing anyone who can submit the form to create variables in your code.mktime()to create a PHP date directly from numeric input, instead of parsing a string.