Best way to store time (hh:mm) in a database

前端 未结 15 2115
面向向阳花
面向向阳花 2020-11-29 18:58

I want to store times in a database table but only need to store the hours and minutes. I know I could just use DATETIME and ignore the other components of the date, but wha

15条回答
  •  抹茶落季
    2020-11-29 19:15

    If you are using MySQL use a field type of TIME and the associated functionality that comes with TIME.

    00:00:00 is standard unix time format.

    If you ever have to look back and review the tables by hand, integers can be more confusing than an actual time stamp.

提交回复
热议问题