I'm creating an online booking form where users have to type in the start time of an event, and the end time.
I have looked at the documentation for the TIME type
and it says
MySQL retrieves and displays TIME values in 'HH:MM:SS' format
Does this mean, that the time entered into the text field will be stored into the time
field in the database? Since I will need to know what time the user books the room for.
Since html has the input type time
this will only take the format HH:MM:SS
, and the time type
in MySQL only can register this format too i believe.
Would this be a good approach or is there another technique that can register time from user and store it into a database?
Yes, your approach is good for dealing with time type data. You should use MySQL time type rather than integer or string. There's a bunch of MySQL TIME FUNCTION which can be used and help you when dealing with stored time in db.
You might be facing with comparing time in further, it's like you might be wanna know an overtime booking, available time for next booking, and so on. For this circumstance, you probably could use one of the MySQL available function: TIMEDIFF function for comparing different time.
This link might helps: http://www.w3resource.com/mysql/date-and-time-functions/date-and-time-functions.php