New schedule scheme - Database

Asked

Viewed 87 times

0

I have an order system, where the delivery time of the product is selected in a normal input of the type='time', and stored in the database in time type as well. Everything is working perfectly, but I will have to change and has to be as follows:

User selects in a select the time that will be as follows:

 08:00 - 09:00
 09:00 - 10:00

... and so on closing the 24 hours of the day

My doubt is how to make this select, whether I have to do it manually in a select or if there is a plugin.

The most important question is in what kind of data I could save this new time method in the database

  • varchar data type - select html do manually, as there should be only 10 tracks at 8:00 to 6:00. You can test in http://kithomepage.com/sos/Novo-esquema-de-horario-Banco-de-Dados.php

  • You can save the full date by providing in the UI only the time and concatenating with the current date in Y-M-D format. In this case, use the datetime data type in the database.

2 answers

1


Create a table with these times and list them in select, so if you have to add more times then it’s easy, just add them to the table.

Save them in time format, if you don’t need the seconds just format it when you list.

0

select is normally created with type = time, and times will be stored in a new table that has reference to the user table.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.