Storing range of Days (M-F) and range of time (7am-7pm) in database
Application Type

I'm designing a dashboard where I would want to display two columns containing range of weekdays and range of working hours. I would also need to create a page where the end user will select the required days of the week and timings. What is the best way to design the UI as well as the best way to store it in the table structure?

For weekdays, I would use a combo select boxes which user can select the day(s). Once selected, how to store it in the table?

For time intervals, I plan to store 24 entries starting 12am to 11pm and let the end user select the interval. After selecting, how to store it in table? 

The sample dashboard would have columns like this

Can someone help in how to design for such scenario? 


Hello Somesh,

Regarding the data model, you could create a Static Entity for the week days. Using an Integer column you can represent the week day numerically, and the platform has a useful helper to obtain the current one:

Week days are a good use case for Static Entities, since the values will not change, and they are easy to query and translate, if needed.

For the time intervals, it depends. Will your time intervals always remain in that format? You could consider using a Static Entity if that is the case, but note that if you ever need to change their format, this will be harder. Otherwise you could create an Entity with two Integers and use them to represent the Start and the End hour, and then restrict the time ranges the user can choose with logic on the screen. This would give you more flexibility if you need to do any changes in the future.

For the screens, it's going to depend a lot on what the user can do. You could try to scaffold them and then work from there as a base for your application.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.