Transform 800 into 08:00

Hi there,

I am having an issue when working with opening times. There are users who can set up shops on the platform and they need to set their opening hours.

I transform the time “08:00” into a number “0800” so I can simply run a “greater than” or “smaller than” condition when I want to find out if a shop is Open/Closed.

However I want to display the opening hours to customers. And there I need to turn “800” into “08:00” / “8:00”. It is just for displaying.

How do I do it?

Thanks in advance for your help.

Better to just use another date with the same time and use the extract (hour) to do the comparison.

1 Like

I am having some troubles setting that up into a nice UX - because I believe there is no option to let the user simply put in a time without date.

Also this method becomes difficult when for example the opening time is 18:15 and current time is 18:07. It would result in a really complicated use of conditionals when trying to determine if a shop is open or not…

From my experience the suggested method is not as difficult as trying to use numbers themselves. Instead I use the hour and minute values through extract and then compare them as a total number of minutes.

That is correct. But there are various ways to accomplish the task you are looking at. Do a search on the forum. You’ll find some posts by me as well as others on setting up time slots and recognizing time values only and ignoring the date value

1 Like

Thanks a lot for your help.

If doing other comparisons as well for the time slots I guess it is better to use the a “date/time” value instead of “number”. In my case it works now as it should (I only want to know if a shop is open/closed & display opening hours)

I added another field to called “Opening Hours Text” and then display that. I was able to turn a number into text by using “VALUE:formatted as :truncated to”.

Bildschirmfoto 2021-06-29 um 17.38.08

That is great you got to to work for your needs. When turning dates into text, it is easier to use the date value :formatted as and then select the time only display.

When using formatted as operator it turns the date value into a text and allows you to have that look anyway you want if using custom, or choose from the various preset options like time

Screen Shot 2021-06-30 at 1.07.10 PM

This topic was automatically closed after 70 days. New replies are no longer allowed.