Forum Academy Marketplace Showcase Pricing Features

How to choose only date and not time

I am building a reservation system for hotels. I have in the database a reservation date, that unfortunately has a time aspect associated with it.

I do not want to have time associated with the reservation as it would not be requested at the time a user would create a new reservation.

Additionally the time portion is causing me distress when trying to put together a condition for the page to display reservations. I am trying to create a repeating group that displays the arrivals for the day, however all the conditionals that I am using also have time attached to the date so I am unable to perform a simple conditional that says:
if the reservation check-in date is greater than current date don’t show
if the reservation check-in date is less than current date don’t show

This should in theory provide a result of reservations that have a check-in date of the current date. However, because of the time connection I can’t display arrivals correctly.

Anyway to only have date and no time connected to it? The time portion is messing everything up for me.

Hi @boston85719 Have you tried formatting the date to get rid of the time?

I have not. I am hoping for some ideas on how to do that.

Currently the database is being auto populated when a user makes a booking which is getting the date information from a date picker.

You can hide the time by using format, but because of the way databases store a timestamp, it will always save something. So, if you hide it’s still there, just not visible.

If you need to check one date against another, you might want to change the time of both of them to 00:00:00 to avoid the hour of the day messing up the condition.

Any idea of how to do that automatically? It wouldn’t be a good use of time to have to manually change each time in the database to 00:00:00.

The reason I need to have the time aspect of each reservation to not be listed is so a property manager could see on the admin page the list of arrivals for the day.

The functionality seems to not allow for a simple conditional that would state if the date = current date make visible. Instead I can only make two conditionals that state if the date < current date make visible (and) if the date > current date make visible.

The problem with the two conditionals is that I can never see the reservations for the current date because the whole system is also pulling the time information, and since no reservation has the same time as the current time, the arrivals for the day are never displayed properly.

When I change the conditional to make it visible this is the result.

Also, I just checked by manually changing the time in the database to 00:00 but it doesn’t save

By the way, the current date and time of my location at the time of this attempt is 12:29PM 29/05/2018.

I just want to capture date and no time element or at least have some kind of work around to display arrivals for the day.

There are several ways you can do it:

One is to change the time to 00:00:00 when the timestamp is saved, or when it’s loaded. Personally, To avoid trouble with time zones, etc, I’d change it when it’s saved.To do that, use the “Change hours to…” and other needed functions to leave the date as is, but change the hours.

Another is to extract the day, month and year in the Condition, and use several AND operators. So the Condition would say Current’s cell’s Reservation’ Check-in Date:extract year is Current date/time:extract year AND Current’s cell’s Reservation’ Check-in Date:extract month is Current date/time:extract month, etc.

On a sidenote, as mentioned, time zones can be a bit of a headache in Bubble (and all programming languages really). I recommend you read up on how they are calculated in the Bubble Help system, because it can be confusing if you don’t know the underlying logic. Just thought I’d mention it as I struggled with that for a while.

Thanks, I will spend some time on it tomorrow and let you know how I get along with it. Sounds like the kind of workaround I am looking for.

Since the past couple of days have been a lot of headaches with some achievements mixed in I figured a read through of the manual and a bit more time on other lessons etc is needed.

Hi Peter
So I tried both ideas and didn’t have luck with either. I’m not sure what is going on, if there is something wrong with the system, the way I have entered it.

Have you had success using the previously mentioned ideas?

This is how I set up the change time to 00:00:00 when the timestamp is saved

But when I make a new reservation the database displays 12:00AM still

After that I tried to set the display function to extract the date etc. as you mentioned like so

And this didn’t work either. By the way I first had only one conditional at the top and when that didn’t work I added the second conditional hoping that would help but still no success.

I then tried to change the way the data would be displayed assuming the fact that I extracted the date, month and year that maybe the system didn’t recognize the data correctly so I formatted the display this way

But this had no effect on the display showing only the current arrivals.

Really not sure what is going on or how to resolve this issue. Wish there was a simple way to just disable time.

When I format it that way I get a mandatory popup field asking me to select the time zone

which apparently keeps time connected to the date unfortunately. So no luck there.

12AM is midnight, just like 00:00:00 – isn’t that what you were trying to achieve? It seems to be saving like expected. When you check the date against another time, for example Current Date/Time, you also need to change that timestamp’s value to 00:00:00, so that the hour of the day is not affecting the comparison.

Not exactly. It was already by default saving the time of the reservation to 12AM.

What I am trying to achieve is to have a repeating group that displays the current days arrivals.

So what I have been trying to do is figure a way to enable a conditional that would basically say if the current cells reservation check-in date = current date then display the data.

Unfortunately I can’t make a simple conditional like that because when I enter into the conditional current cells reservation check-in date I don’t have the ability to simply put an equals symbol, instead am only able to do < or >.

So, what I am left to do is make to conditional statements like so

However, when making these conditional statements I am unable to change the current date/time hours, minutes or seconds, as seen below

So my ultimate problem is that I can’t tell the system to disregard the timestamp portion and only focus on the date. Since that is not possible I am unable to display the current dates arrivals because the system for some reason is always using the time portions as well.

You could set up a Date Range, and include everything between 00:00 and 23:59 instead?

Anyone have any luck with this? I’m in the same boat in that I don’t want any time values stored when a date is stored. We’re dealing with the classic time zone issue. I want to just store December 25, 2021. No time.

It is not possible…by default if you don’t choose a time, it is added to the database as midnight on the date selected. The date datatype by default includes a time componenet

It’s an old topic, but maybe somebody is still looking for a solution.
I have a similar situation, so what I did:

Or, if all the Data are stored like in my case with the timestamp 12:00am

Hey @boston85719 . I found a workout. You can check if the date is between a range
So in my case I wanted to get all bookings on a particular day…
Say if the date of the bookings I want is on January 1, 2021, I would set up a constraint to give me bookings where the date is between
Current date/time, change the seconds to 59, minutes to 59 and hour to 23
Current date/time, change the seconds to 0, minutes to 0 and hour to 0
The image below will show the workflow I used in my app