"Change Hours" writes wrong time in database

Hi,

I try to save a Date/Time value in the database an have a wrong time saved. When I take the Date/Time-Picker and save - I have no problem. My local time (UTC+2) ist saved.

But as far as I use the “change hours” function I have a problem.

As you see here I give the hour the fixed value “8”:

When debugging everything seems to be ok:

But with a look in the database I have the hour “10” stored.

Seems to be a problem that the functions always calculates beginning from UTC and not from the local time?
Or what can I do instead?

Thank you,
Stefan

There is only one time that is saved. regardless or where you are in the world (it’s a number that is a UNIX time stamp). So your issue isn’t what is saved, but how you display it. Check the formatted as option and pick a timezone, that’ll do it.

2 Likes

Thank you for the fast answer. But that doesn’t work.
I have a date/time value. I change the hour to a fix value “8”. Save it and when I read the time and display it like this


there are different replies:
Saved by a date/time-picker: 8:00 showed (correct)
Save by the formula: 10:00 showed (incorrect)

What do I do wrong?

Hi, I would be happy to hear the solution - how can I use “change hours” function without have a wrong time saved.
Thank you very much!

If you post a link to a real situation it’s easier for other to help.

Hope you can read the link. I did a prototype with the same problem

I think we’re hitting a bug indeed. We’ll look into it in the coming day.

Thank you!

This should be fixed now.

1 Like

Very fast service :smile:
Thank you so much

Hi there, I’m not sure this has been solved because I’m running into the exact same problem when saving a date while changing hours, and checked every which way to make sure it’s not a mistake on my end.

I am testing how time saves if users are in different timezones.

The two timezones I’m testing are one hour apart (mine is an hour ahead of the alternative). I have a button which saves a time from the list of times, and a display of the same time, both displayed in the local timezone. The test is they should be displayed exactly as the same time in their respective timelines. Saving the time in my timezone yields one to one date with the time saved, so it works there. However, in the alternative timezone, the time saves one hour ahead of the alternative timezone, making it two hours ahead when I switch to my timezone, which is incorrect. So, there are two things going on making me suspect a bug:

  1. The time saved is one to one in my timeline, but an hour off in the alternative timeline. It should be one to one in both instances, as when I save in the alternative timeline, the view from the alternative timeline should be the same as the date supposedly being saved.
  2. An adjustment is taking place when saving a time then switching the timezone, which is what I want and indicates bubble is doing work to make it happen, but due to the 1st statement, the adjustment is incorrect.

Let me know if this makes sense. My time is GMT, but you can test it with two different timezones on my app: Alijpractice2 | Bubble Editor

Are you switching the time zone on your machine or are you just switching the time zone at the date is formatted with?

On the machine. Just so you know, I’ve figured out a workaround that’s made me convinced this is a bug on bubble’s side, as I’ve now made a separate input that changes the hour, then I save that time (instead of getting the button to change the hour in the workflow and save the calculated time ), and it saves fine.

Hi:

Just wanted to say, I have an extract hour calculation that does that same thing when I use a browser extension to test the time zone.

I do believe it is an error on Bubble’s side since the format as… option gets the right time but the extract hours option does not - it adds the time zone shift twice.

I wrote about it here

this can help

Thank you Matt. :slight_smile:

Been really thinking about how the database is set up and I think I have a new way to do it, so I’ve been investigating that. Have read this post before but now I see it in the context of a new problem I have so this will really help. :slight_smile:

i’m having a similar issue where I have a date saving and displaying correctly in my timezone (Eastern), but several users in Central Time zone are reporting the date being off by one day.