Alex Rivera | Logout

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

Asked 2009-02-11T20:57:04.300
131

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 what's the best way to do this without storing more info than I actually need?

Edit
Report

1 Answer

3

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.

answered 2009-02-11T21:21:44.133

Your Answer