Opening and closing hours of a store

Could someone help me on how to make the premises appear open or closed if the hours are from Monday to Friday 9:00 a.m. to 3:00 p.m. and 5:00 p.m. to 9:00 p.m. Sunday CLOSED

Thanks

Does this need to be dynamic for multiple different businesses, or is this specificly for one business with those specific hours? Are there any Saturday hours?

2 Likes

yes, it is only for a business.
the time is

Monday to Friday
9:00 a.m. to 15:00 p.m. and 17:00 p.m. to 21:00 p.m.

Saturday
9:00 a.m. to 15:00 p.m.

Sunday
Closed

if you see from Monday to Friday from 15:00 to 17:00 it is closed
and on saturday from 15:00 it is closed
Sunday is closed all day.

Thanks

1 Like

There’s several ways to handle this depending on how flexible you need it to be, or if the days and times would ever change. What I show below is maintainable, but may take a little bit to fully understand it and how the IF column works. But in it’s simplest (least amount of columns) form, I would do it like this. It could be changed to make it easier to understand, but it would take a few more columns to build it out.

  • First I would create a math column to figure out the current weekday number:
  • Next I would create another math column to figure out the current hour:
  • Finally I would create an IF column to use those values to determine if the business is open or closed. Keep in mind that this is based on the current date and time of the current user’s local timezone:
    • What I do here is first check if the weekday is 1 (meaning Sunday), then return Closed.
    • Next I check if the hour is before 9:00, then return Closed so we eliminate any hours less than 9.
    • Next I check if the hour is on or after 21:00, then return Closed so we eliminate any hours greater than or equal to 21.
    • Next I check if the hour is before 15:00, then return Open since any remaining unchecked hours prior to 15:00 on Monday through Saturday are Open.
    • Next I check if the weekday is 7 (meaning Saturday), then return Closed because the only hours left to check are between 15 and 21 and Saturday is closed during that time.
    • Finally I check if the hour is on or after 17:00, then return Open because all that’s left to check are the times between 17 and 21 on Monday through Friday.
    • Anything between 15:00 and 17:00 will fall into the ELSE and return Closed.
8 Likes

What an excellent example of the “working backwards” approach. Superb! :clap:

5 Likes

Thanks a lot. for your great help but I have a problem I don’t know if it’s because I live in Spain but it tells me that the week is 1 and I should put it as 7 since right now it’s Sunday
I show you capture

image

image

I do not know what I do badly

Here I leave you how I put it and thank you very much

I think it’s the default behaviour of the WEEKDAY function. Sunday = 1, Monday = 2, Tuesday = 3 etc.

1 Like

Ok Thank

Good morning open sale today Sunday classes should go out

This depends on your audience and their time zone. I gave up on using Glide to manage on-off times, so I moved to Integromat to push a ‘is-closed’ value on a scheduled basis to the app. I could not reliably use Glide time… as every device things it has the ‘correct time’ for math, etc.

2 Likes

Hello Mark_Turrell,
How is Integromat?

Easy to use - and you can do a lot of stuff for free too. It is a no-code backend.

My scenario for opening and closing is based on the following ‘scenario’

  • opening hour module - runs at a specific time (open!) - and it updates a row in a Google Sheet ‘toggle-open’ kind of thing. The Google Sheet is used by the Glide app for visibility
  • and closed is the same :slight_smile:

So very quick to do. Doing it in Glide took hours and hours, and there were too many cases when the user device did not pick up the right time, etc. This way is automated and easy :slight_smile:

1 Like

Is there an example video to see how it’s done?
Or where can I find an example?