Activate the purchasing services according to the opening hours: morning and afternoon

Hello everyone, I recently know Adalo and I need help. It seems to me an excellent tool but at the moment I’m going crazy to manage the activation of orders based on the opening and closing times of the restaurant.

The need is simply to check on the basis of the current time if the restaurant accepts orders or not. If he accepts them, I can show the checkout button, otherwise a message informing the user that the restaurant is currently closed.

Two shifts are scheduled for each day: in the morning for example between 11:30 - 14:00 and in the afternoon for example between 18:00 - 23:00. The problem I find is related to the moments when the restaurant is closed: I cannot make a warning appear preventing the order from being placed.

Is there anyone who has managed this problem and can help me? Any kind of help is welcome!



Hi @stffnc1974 we don’t have any out of the box way to check times, but something you can do is using math formulas (Math & Custom Formulas - Adalo Resources), you can get the current time by doing something like:

Date & Time > Current Time - Date & Time > Start of Today × 24

This will give you the hour of the current time, and you can probably use this to determine whether it’s within the range of the open hours. It might be a little tedious, but let me know if you have any luck!

Thanks @jeremy , I have tried to manage this problem in all possible ways but I doubt that it is currently feasible. It’s a shame. However I will try as you recommended.

Alternatively, I could manage the matter in another way: the venue is always open, but I have time slots (like simple strings 12:00 - 12:30, 13: 00-13: 30 etc …) and I must user to select at least one.

I believe this can work.
Thanks for your advice.

@stffnc1974 @jeremy I just created a post on how to work with time calculations.
First, read

If you want to compare time slots such as opening shift, you basically need to compare the decimals/fraction part of the Date&Time field.

I tried the following:
I created a Collection with two additional Number fields to store the time information for start and end:

Using a Form, I first create an entry for the shift data.

Note that there is a second action to update the calculated time fractions:

The formula basically uses the INT() function to cut off the days before the decimal point.
The entries in the database look like this:

To make the Order button only Sometimes visible I need to calculate the time fraction of the Current Time and make it available on the screen:

I used the following to test it:
First I created another Collection to store the calculated time fraction:
Holding just one record:
For multiple users, you need to link this to the User collection (I skipped this here).

Next, I added a Button to the screen AND moved the button into a list (Make List):

This list can now hold the NOW collection:

The Button has two actions:

The first one is calculating the time fraction of the current time and updating it to the collection.
The second action is linking to the target screen:

Now I have the data available to fill the fields to make the order button only visible when the current time is between the start and end of the shift:

In addition, I also calculate, how much time is left until closing:

The text label uses a Custom Formula:
which looks like this:

To get back to the minutes I have to multiply the difference with 1440 (minutes per day) and use the ROUND() function.


Hi @karimoo , thanks for the explanation !! You are a great !!
I started implementing the solution using your advice.

From what I have verified, the decimal value that corresponds to the time varies from day to day. This means that 10:00 AM on 20/06/2020 have a decimal value different from 10:00 AM on 21/06/2020 for example.

This means that I should upload the annual calendar. It is not feasible. My idea is to have a collection that welcomes the day of the week and the opening hours:

  • day - start fraction - end fraction - venue
  • Monday - 12:15 PM (in decimal value) - 12:45 PM (in decimal value) - Venue X
  • Monday - 12:30 PM (in decimal value) - 13:00 PM (in decimal value) - Venue X


In this way, based on the user’s day and time of entry, I would be able to extract the times for that day of opening and closing.

The problem I have now is that the hourly time (in decimal value) is different for each record because I cannot represent the start and end times with a fixed numeric value. Uploading the entire annual calendar is unthinkable.

I hope I explained myself.
Do you have any suggestions?

Thank you


@stffnc1974 Hi Francesco, that is a strange thing.
I looked into it by creating some records saving Date & Time with the Date Picker and updating a number field with the formula to calculate the time fraction:

on the next screen, I just list the values with different formatting:
(I am in time zone +2, in case you are confused by the unformatted date/time display)

In addition, I used the Recalculation Button to do the same calculation again and save the result in a second number field:

I could not find a difference in the time fraction for different days here.

At the beginning of the testing using the date picker in the preview, I once could create a different value as you described in the database table view. Unfortunately, I did not take a screenshot.
I tried to reproduce it but did not happen again.

The only explanation I have is that somehow a different value was saved to the database table. The calculation is working fine, but there might be a problem with the date picker - at least in the previewer.


Thanks @karimoo for your availability !! I checked again, in fact the problem is the Date Picker component (maybe the milleseconds that are not visible affect). To have time slots with 15 minute intervals, I have to dynamically add the minutes to the starting time. I noticed that the “time fraction” decimal value remains the same, regardless of the day, if the date and time value of the initial date picker component remains unchanged.

If you change the value of the date picker by one hour then it generates different decimal values!?!?

So as I solved, I keep the value of the date picker fixed and add the minutes up to the occurrence for a day of the week. Then I extract the csv file, add the other days of the week keeping the time fraction decimal values ​​calculated previously. Then I upload the file with the remaining days into the collection.

A very tricky procedure but I think it is the fastest and most efficient way.

Thanks again for your help and for your kindness.
@karimoo… you are the best!

1 Like

Hi I am implementing similar app with duration between dates. Are you available to freelance?? Please send email to with your rate if you are available. Many thanks.

I have run into the issue somebody had also posted, although basically my 5pm is 0 (should be 12:00am) and my 4:59 is .9993… How can I add to my formula to make it to the correct decimals