Will
Will

Reputation: 4744

What data type should i use for time (not date)

If i have an event with a date, and then want the user to state a start time and a end time, what is the best / most standard way to represent that in the db?

Is there a time data type or should i just have start_at end_at in the database and convert whatever is in the UI to that?

Upvotes: 0

Views: 66

Answers (3)

Artiwarah Damrongchai
Artiwarah Damrongchai

Reputation: 79

If you're using MySQL you can use TIME datatype to store a time.

Upvotes: 1

Wazzaps
Wazzaps

Reputation: 380

You can use TIME type. The format is: HH:MM:SS. Source: Link

Upvotes: 0

Stimpson Cat
Stimpson Cat

Reputation: 1516

You can use the timestamp. Why not use it to mark the start and end points in time. You can transform them in your application to some more useful Time/Date type.

Upvotes: 0

Related Questions