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

前端 未结 15 2160
面向向阳花
面向向阳花 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:27

    The saving of time in UTC format can help better as Kristen suggested.

    Make sure that you are using 24 hr clock because there is no meridian AM or PM be used in UTC.

    Example:

    • 4:12 AM - 0412
    • 10:12 AM - 1012
    • 2:28 PM - 1428
    • 11:56 PM - 2356

    Its still preferrable to use standard four digit format.

提交回复
热议问题