Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 763591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:35:13+00:00 2026-05-14T16:35:13+00:00

In my shops database I need to have the opening hours. Do you have

  • 0

In my shops database I need to have the opening hours. Do you have an idea how i can implement this in my dB?

The opening hours are from Monday to Sunday, each day can have 2 opening windows (ex 09:00-12:00, 16:00-19:00)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:35:14+00:00Added an answer on May 14, 2026 at 4:35 pm

    build another table, call it schedules, add a foreign key to the shops table primary key, a Day of week field, time_open, time_closed.
    The data should look something like this:

    shop_id     day_of_week      time_open        time_closed
    1           1                09:00            12:00
    1           1                16:00            19:00
    1           2                09:00            12:00
    1           2                16:00            19:00
    1           3                09:00            12:00
    1           3                16:00            19:00
    1           6                10:00            14:00
    2           1                09:00            12:00
    2           1                13:00            18:00
    

    This will give you the opportunity to build any kind of schedules, with as many windows as you want, with how many exceptions you need. It’s universal, limited only to the fact that it expects all weeks to be identical. No holidays considered, nor odd/even-week schedules that someone might use.

    Edit:
    With Julien’s question, about working hours of a night business, it has come to my attention that the previous solution is not the best bu far. You can’t have a bar open at 20:00, close at 06:00, and compare if current time (02:45) is inside this interval, because it won’t be. That’s why, it would be most convenient to register not the closing time, but the total working time, in the convenient unit of measure (minutes for example).

    shop_id     day_of_week      time_open        working_time
    1           1                09:00            180
    1           1                16:00            180
    1           2                09:00            180
    1           2                16:00            180
    1           3                09:00            180
    1           3                16:00            180
    1           6                10:00            240
    2           1                09:00            180
    2           1                13:00            300
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom control that shows a value obtained from the database (the
I have a database generated page which shows lots of links. This page consists
Currently I have an application that takes information from a SQLite database and puts
I am new to ADO.net and have this problem: Let's assume I have these
I need to write an SQL-Query for a csv-export. I have a table stores,
In my work we need to generate contract documents that dynamically extract information from
I've worked in shops where I've implemented Exception Handling into the event log, and
I was curious as to what other shops are doing regarding base application frameworks?
In C++, there isn't a de-facto standard logging tool. In my experience, shops roll
TFS shows some pending changes under my name, but I have not changed anything.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.