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 603471
In Process

The Archive Base Latest Questions

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

I’m writing an application that indexes data for our stores, some of which are

  • 0

I’m writing an application that indexes data for our stores, some of which are open late (8 am – 2 am). We need to be able to search this database quickly — basically, to run a query to find which stores are open at a given point in time (now, Sunday at 1 am, whatever).

In addition, the open/close times can vary day-by-day — some stores are closed on Sundays, for example.

The obvious solution to me would be to make a table where I have a row with the store ID, day, open time, and close time. For something like Monday, 8 am – 2 am, that would actually be two rows, one for Monday 0800 – 2400, and one for Tuesday 0000 – 0200.

We have a lot of stores, so the search has to perform well (basically, the data has to be index-friendly), but I’ll also have to display this data back out in a human-readable format. With my current solution, that’d look something like this:

Monday: 8:00 – Midnight
Tuesday: Midnight – 2:00 am; 8:00 am – Midnight

I’m just wondering if anybody else has alternative solutions before I jump right to an implementation. Thanks!

  • 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-13T16:56:04+00:00Added an answer on May 13, 2026 at 4:56 pm

    When PBS (the US Public Broadcasting System) faced this same problem a couple of years ago, they invented the idea of the “30 hour day” — Where 00:00 is midnight at the start of the day, 24:00 is midnight at the end of the day, 25:00 is 1am the next day, 30:00 is 6am the next day. That way Mon closing time of 26:00 is 2am Tues morning.

    Rather than two records representing a single store’s times for a day, it may be more object oriented to think of the “store day” as the object. That way 1 record = 1 store’s times for a day. If you want to store the two sets of open/close times, just use four fields in the record instead of two–and adjust your queries appropriately.

    Remember that your queries should use a library/api that you write and publish. The library will then deal with the data store and its data layout. No one but your library should be looking at the db directly.

    Time zones are very important in this sort of app too. (Hopefully) at some point, the store chain will expand to cover more than one time zone. You’ll then need to determine the local time of the query. — May not the same as the time zone of your server which is handling the queries.

    Further thoughts–

    I now see that you’re standardizing to GMT. Good. You could also use datetime values (vs time values) and standardize to a given week in time. Eg open time is Sun Jan 1, 1995 10am – Mon Jan 2, 1995 2am (using Jan 1, 1995 as a base since it was a Sunday).

    Then rationalize your “current time and date” to match the same point in the week of Jan 1, 1995. Then query to find open store days.

    HTH,

    Larry

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I am writing an app for my school newspaper, which is run completely online
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.