Hi there, I’m struggling to understand how to deal with time zones. I have a “Datetime” field in my database, so each time I create a new thing I enter a specific date and time.
It seems like I can’t specify a timezone for each entry as well as I can’t select a default timezone for my entire application. Therefore, Bubble stores my DateTime value in my current timezone (which is CEST)
Indeed, if I display the DateTime field in the frontend, and I select a “static timezone” such as UTC or America/Los_Angeles, the DateTime field is automatically doing the math and display the correct time in UTC or Los Angeles time. It’s great for the “things” I create as an admin, because it automatically detects my timezone.
My questions are:
What happens if a user creates their own things? Will Bubble use my timezone or the user’s timezone to save a thing in my database?
If the answer is the user’s timezone, doesn’t that will affect the reliability of my database? I will have things with a DateTime field populated in many different timezones, but I don’t have a reference of the timezone in the DateTime field.
My Bubble database is an exact copy of an AirTable table. I import items from AirTable to Bubble via Integromat. So Airtable is the source of my things, and the DateTime field is always expressed in CEST. When I import the database in Bubble, the Bubble’s DateTime field is also in CEST because that’s my current timezone now. But what happens if I travel to another country? Let’s say that I travel to Los Angeles. In that case, my timezone would be PST. If I import the AirTable database, where the DateTime is in CEST, Bubble will import the actual time in that field, but it will consider it as PST, right? If so, the conversion won’t work anymore.
An example to clarify:
Title: Object 1
DateTime: 4:00 pm CEST
When I am in CEST:
Title: Object 1
DateTime: 4:00 pm (considered as CEST)
When I am in PST:
Title: Object 1
DateTime: 4:00 pm (considered as PST)
Is my assumption correct? Any suggestions to make it work?
Hey @viquarahmed07 thanks for your help! That makes sense. However, if I understand correctly, it refers to the passing dates as text. You have to specify the timezone, otherwise, Bubble will consider the client’s timezone. And that makes sense.
However, I would like to pass a date as a date, not as a text to be converted. And in a date field, I can’t specify the timezone as many comments in that topic point out. That’s really frustrating.
Ok thanks @adamhholmes. So if I have 08/26/2022 10:00 am stored in a date field and considered as a timestamp. I want to display that as UTC, I am going to select a static timezone from the builder. Specifically I am going to pull the timestamp from my date object and will select UTC as static timezone.
Therefore I would expect to see: 08/26/2022 10:00 am UTC.
Actually, I see 08/26/2022 08:00 am.
Which is 2 hours behind my timestamp and also is the offset between UTC and CEST (my timezone). Why does that happen?
So you’re setting a date/time in your database, directly in the app datatab (08/26/2022 10:00 am in your own time zone - which is UTC+2), then displaying it in UTC (which is 2 hours behind you), so the time displayed will be 08/26/2022 08:00 am, which is exactly what you’re seeing.
Ok, will try to rephrase…Imagine that I want to copy/paste a time from an external source to a date field in Bubble.
That external source provides the date and the time in PST. If I am based in CEST, copy/paste will not work.
If I copy an absolute value as 10:00am (expressed in PST) and paste it in Bubble, it will be 10:00am. But because I am based in CEST I should modify that value and make it 07:00pm. Then I can paste it to Bubble and it will work.
I don’t want to manually manipulate the data. I want to copy/paste directly. If I could set PST as the default timezone in my app, copy/paste will work. 10:00am will be PST, as provided by my source, even if I am in CEST.
I’m not sure I have the right answer, but I, like you, spent hours trying to figure out the Oregon time from the Bubble server (AWS), the default UTC, the timestamp, and the multiple time zones… I finally decided to NEVER use DATE but rather numbers. When I use the current date, I use EXTRACT date, month, year, hour, minute and seconds. So in my case, if you are in New York or Los Angeles, it will work if I want to send a message at 9am, regardless of the region. By the way, Bubble uses a different “plugin” for the date, and it lacks some short values (like PST). Suggestion use short like: “EST2EDT” instead of “EST”.