0

Hi all,

I want to store the hours of restaurants in a database (sounds simple, right?). I don't want a text field where hours are entered as a lump of data, but was thinking of making a column for each day of the week and filling in the hours this way. I was planning on doing something like this...

hours_sunday_open
hours_sunday_close
hours_monday_open
etc, etc,

Then I realized, what if the restaurant is open from say 4PM on Friday and doesn't close until 2am Saturday? This method won't work so well.

Any idea how I can store the open/close times taking the above problem into account?

It is not an option to just have a varchar or text column labeled hours. I'd much rather list each day separately for search purposes.

Thanks

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by loligator
0

There are a few different ways you can approach this.
You can still use your original concept, when validating the data for display, if the close value is less than the open, then obviously it is the next day. That seems to be the easiest, as long as the data has to stay in the db.

There are other ways but I think the above concept is sound.

0

There are a few different ways you can approach this.
You can still use your original concept, when validating the data for display, if the close value is less than the open, then obviously it is the next day. That seems to be the easiest, as long as the data has to stay in the db.

There are other ways but I think the above concept is sound.

thanks for the input. i'll stick with my original idea.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.