I'm unable to get the TIME for datetime datatype. I do get date but not able to get time and insert into database using PDO PHP. What needs to be done in the following code to get the time along with date. I tried with H:i:s but it inserts data as 1970-01-01 00:00:00
Date format for input is 08/31/2020 - 05:04 pm
I am looking for date and time(hours and minutes).
$dp = date_create_from_format('m/d/Y',$_POST['dp']);
//CHECKS VALUE
$stmt->bindValue(':dp', $dp->format('Y-m-d'), PDO::PARAM_STR);
//GETTING POST VALUES
$dp=$_POST['dp'];
$dp = date('Y-m-d', strtotime($dp));
//BINDING PARAMETERS
$query->bindParam(':dp', date('Y-m-d', strtotime($dp)));
NOTE: All the above code works fine with getting and inserting date but does not work with date and time both.