Inserting NOW() value in datetime datatype is returning 0000-00-00 00:00:00

后端 未结 3 1169
攒了一身酷
攒了一身酷 2021-01-26 10:13

I had a database that had a perfectly working NOW() function, displaying the right date. And after accidentally deleted it, I created a similar database, but when I inserted NOW

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-26 10:48

    What you're inserting is the string "NOW()" which is completely different from the function call NOW().

    As "NOW()" is not a valid date, it goes in as zero.

    Removing the quotes from that should fix the issue.

提交回复
热议问题