dpquu9206 2017-11-17 09:46 采纳率: 0%
浏览 353

MySQL表日期更新在表格中给出00/00/0000 12:00:00 am格式

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%"';
  • 写回答

1条回答 默认 最新

  • duanbai1027 2017-11-17 09:54
    关注
    $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.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!