Help understanding logic

Hello! I am a total noob to Bubble and am having some serious difficulty trying to understand the logic when relating to dynamic data.
I created a little dataset that has fields with dates/times and I am trying to evaluate the date time in a text field.

My goal: find the record where the field titled “date” equals today’s date and show the time portion of the fields “opening” and “closing”

Im basically here and nothing really makes sense

Thank you for your patience in advance.
Im reading the manual and doing the tutorials which mostly make sense but when I try to do something from scratch I loose sense of the logic.

Are you trying to build a schedule for a business or something similar ? Because I wouldn’t recommend using date types if I were you.

Its an operating calendar for our park. So each day has different park opening/closing times. I want to display the record for today and show the opening and closing.

I kinda got it working but I don’t know if this is the best route. It seems a bit of a hack job.

Alright ! This is a tricky question, and there are many ways to implement that. This is what I would recommend :slight_smile:

First, implement a “Day” type as follow which will be holding the data of a typical day of your park slot. The “Day Number” matches the index of the day in the week (ie. Sunday = 0, Monday = 1, Tuesday = 2, etc …).

Then add a list of “Days” in your “Park” type (or whatever you named it) containing all the 7 schedules.

Capture d’écran 2020-01-08 à 18.06.50

When this is done, you just have to refer to a given “Park” to have access to its schedules on a daily basis. By extracting the day attribute of the current Date/time you can filter the list and get access to the data you’re looking for (ie today’s opening/closing hour + minutes).

Note that I assumed all the schedules for a given park slot were the same every week.

Capture d’écran 2020-01-08 à 18.07.39

EDIT: example of the DB

Thanks for the help. Unfortunately day of the week doesn’t play a factor. It’s unique for each day of the year, which is why we generally go by the actual date.

preferred method would be to format “date” as MM/DD/YYYY and compare it to current date/time formatted as MM/DD/YYYY but I don’t see any way to manipulate formatting of the field before the operator.

Ok, then you could use the same method and store all 365 days and filter by extracting and comparing “date” and “month” (and maybe year too even if you should probably try with date and month first).

The problem with “date” type is that it’s too restrictive IMHO.

So you are recommending a text or number field with something like YYYYMMDD or 3 fields for YYYY MM and DD ?

More like 3 different fields.

1 Like

This is the correct way to test if two dates happen on the same day (in Bubble). The result is a boolean.

DateX:formatted as MM/DD/YYYY is DateY:formatted as MM/DD/YYYY

You can build that expression anywhere. If Bubble’s giving you issues with constructing that, reload the page.

Note that if you need to perform some operation on one of the dates, you can only do it on the left one.

(Once left date is formatted as text, the entire expression must be of text type and the only operators that will appear for DateY will be those that result in text.)

Could you help with a screenshot of using this logic? When I try, I cannot format the Data field


Oh, you’re in a constraint. Well, that’s different.

Here’s a text element where I have a list of dates and I am filtering them such that the list of dates will be only those dates that are “today”:

I believe you need a field in your day type where you will store the date of each item in your table. Or a text field with the MM/DD/YYYY format.

I see all your fields are text or numbers.

When you have a field type date the option :formated as will show up.

Alternatively, if you store the info as a text with the MM/DD/YYYY format you can build the constraint as

Your text field = some date:formated as MM/DD/YYYY

My fields are date type

Unfortunately a data search isnt giving me those same constraint options

I was looking at another post in this thread.

I have something similar to what you ate trying to accomplish and I use the text field as MM/DD/YYYY alternative.
Works just fine for me.

Right. You constrain differently, get as small a blob as possible, and filter that.

Of course, if you’re just looking for today’s hours, isn’t the search:

Do a search for things constrained by thing’s date field you’re interested in is > yesterday and date field you’re interested in is < tomorrow?

There’s only 1 answer to that search, right?

Correct, there is only one record returned for each day of the year.

Makes me wish there was a field type of date instead of date/time

Dates ARE times. Learn more here:

Thanks. I am familiar with date types and how the are generally based on unix or epoch.

I am more familiar with MSSQL when dealing with data and it gives me many options for how to store date.

If bubble only has one date type thats just fine. I just wish I could format it as date when evaluating.