Datetime vs Date and Time Mysql

后端 未结 4 653
自闭症患者
自闭症患者 2020-12-31 00:19

I generally use datetime field to store created_time updated time of data within an application.

But now i have come across a database table where they have kept dat

4条回答
  •  星月不相逢
    2020-12-31 00:47

    The tricky part is when you have to do date arithmetic on a time value and you do not want a date portion coming into the mix. Ex:

    myapptdate = 2014-01-02 09:00:00

    Select such and such where myapptdate between 2014-01-02 07:00:00 and 2014-01-02 13:00:00

    1900-01-02 07:00:00 2014-01-02 07:00:00

提交回复
热议问题