I am updating datetime column in one table, but when update the column date save as 00/00/0000 12:00:00 am.
Here is Mysql query
update b_tasks set DEADLINE='28/12/2017 01:30:00 pm' where ID=4666 AND TITLE LIKE 'Perform demo%'. And in PHP look like
$sql='update b_tasks set DEADLINE="'.$dtformat.'" where ID="'.$tid1.'"
AND TITLE LIKE "Perform demo%"';
$sql="update b_tasks set DEADLINE=STR_TO_DATE('".$dtformat."','%d/%m/%Y %h:%i:%s %p') where ID='".$tid1."'
AND TITLE LIKE 'Perform demo%'";
Try above query.
You need to use STR_TO_DATE
, which convert your given format string to date.
If you don't want to use this function you can go with default format 'yyyy-mm-dd HH:MM:SS'
This will help you.