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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:32:00+00:00 2026-05-29T21:32:00+00:00

I have many companies each one have a opening date and a closing date

  • 0

I have many companies each one have a opening date and a closing date ex :

Company  Open   Close

A        08.00  22.00     (close in the **same** day)
B        10.00  02.00     (close in the **second** day)
C        14.00  03.00     (close in the **second** day)

On the web page the user must see a list of the companies and show the status of each one (open or close) depending on the current time (SERVER TIME)

THE PROBLEM :
when the company open and close in the same day ( A ) it’s easy to get the status
in the following algorithm : isOpen = (NOW > OpenTime AND NOW < ClosingTime)
, but if the company open in day 1 and close in day 2 ( B , C ) if the user check the page at 1.00 the company B will appear closed (because (1.00 > 10.00 AND 1.00 < 02.00) is False ) but in real time its opened.

How can I resolve this issue (when the closing time day is different than the opening time day)

  • 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-29T21:32:01+00:00Added an answer on May 29, 2026 at 9:32 pm

    The easiest solution I can think of would be to check if the close time listed is less than the open time and add 24 hours, and check against that value

    isOpen = (NOW > OpenTime AND NOW < (ClosingTime < OpeningTime ? ClosingTime + 24.00 : ClosingTime)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have an application in which many companies post information. the data from each company
Currently, I have a table of companies, and each company has a table to
I have many to one relation, let's say User has a Company. Company entity
The customers (clients) of an ASP.NET webapplication are companies and each company may have
We have many projects with several files inside each. Files can be checked in
I have many text files containing bank transactions in the middle of them. Each
I have many MKMapViews, and each of them has an annotation. I am trying
I have a Sqlite database that has a table consisting of company information (Companies)
So I have three tables and subsequently three models as well: Company (table: companies)
I have the following many companies. Some of the companies have subjects and others

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.