How to make a mysql table with date and time columns?

前端 未结 2 1876
长发绾君心
长发绾君心 2021-01-15 04:52

I am trying to create a table that has date and time columns used to store the date and time information when the entry is recorded in the database. In the MySQL documentati

2条回答
  •  一个人的身影
    2021-01-15 05:31

    CREATE TABLE t1 (
      ts TIME,
      dt DATE
    );
    

    Only a timestamp field can have DEFAULT CURRENT_TIMESTAMP. It contains both a date and time. TIME and DATE fields will need to be set by your application.

提交回复
热议问题