Date and Time Functions & Daylight Savings

I have functions performing based on time conditions using the Hour(Now). What is the best way to account for changes in time due to daylight savings? In the future I’ll also need to account for time zones so any tips would be very helpful!

Can you explain some more? Hour(Now) is based on the user’s device time. If there device’s clock adjusts for daylight savings or different timezones, then the Hour(Now) calculation will adjust accordingly.

1 Like

Hey Jeff. Are you sure it is based on the device time (does this include desktop browsers for Pages)? I just thought it would be UTC as this is usually the case. Of course, if it is device this than that’s a whole lot of headaches saved! I can’t kind a reference to it in the docs!

Yes. It’s a computed column. All computed columns are computed on the user’s device, including desktop browsers. If we opened the same app at the same time. What shows as Now for you would be different for me.

Case in point, I used that fact as a basis to determine the user’s timezones offset in this example.

3 Likes

I stumbled across something related to daylight savings today. I have a table with calendar events and a Zapier action that makes copies of the events. What I noticed is that when the original date and the computed date span a change in daylight savings time, the times get adjusted for daylight savings.

Here’s a simplified example: I don’t want the time to change in the computed column, just the date.

Update: I tried unchecking the “Respect time zones” box in the Start time column and nothing changed in the computed column (or so I thought), but I just hadn’t waited long enough and it’s a big table. Now I see that did the trick. Since all users for this app are in the same time zone, I guess that’s the solution - just uncheck that box.

Or does anyone else have a way to make computed columns add days without changing times?

Update 2: Now I’m having a different problem with the “Respect time zones” box unchecked - my copies are all being made at 12:00. Have to dig into this more…

Out of curiosity, with Respect Timezone checked, what happens if you change your computer’s date to March 10th or after so daylight savings kicks in on the computer? Does the time in the math column correct itself, or does the time in the original date column change?

What do you mean by “copies”?

Thanks Jeff. Interesting question about my computer date. I’m using a Chromebox and I can manually set the time zone, but I don’t see how to manually set the device date. :thinking:

Regarding copies: The calendar events I’m copying are for scheduling crews. We change up the crews every month or two. I create the first event for the new period, then use a Zapier action (looping) to make copies of that event for the rest of the period.

It’s a bit of a workaround. Recurring calendar events would be nice.

I’ll test it out a little bit to see what happens for me.

Hmm, I don’t use Zapier, but I would have to guess that somewhere in the Zapier flow, the time is being lost.

So I tried changing my computer date to March 24, but it didn’t seem to affect anything in the Glide table. I’m not sure if that’s because I was forcing the date and time or if it just doesn’t have an affect. I would have to wait 2 weeks to find out for sure.

I did come up with a solution though. This is a little convoluted, but there is a way to get the correct time even when using Respect Time Zone.

  • In my screenshot, I have a Date column and a Date+7 column that adds 7 days.
  • Next I have two Format Date columns that calculate the timezone offset for both the Date column and the Date+7 column.
    image
  • Finally I have another math column that calculates date + 7 days again, but also applies the difference between the two timezone offset values which are different because of daylight savings. This gives the expected result.
3 Likes

Thanks for working it out! This is how I end up with 200 columns in a table…

1 Like