🕒 System/GMT Time - Solved!

Hola de nuevo

@Simon_Hill no problem, I understand what you meant. What we are looking for (in my case) is a reliable time using an automatic way without firing a manual action in the middle. Also, if we can do it using Glide tools 100% we would make a home run but sometimes we wish and sometimes we fail :upside_down_face:

@Jeff_Hager you’re absolutely right… te odio! :rofl:
You remind me my mom, she always paid attention to details and those rare scenarios that make an exception. I had noticed that problem with timezones with -/+ 30 or 45 min thinking in my country (currently Venezuela quit using -4:30 offset and now we use 4:00).
Having said this, my workaround is useful for 93% of cases :zipper_mouth_face:

Have a nice night… feliz noche!

1 Like

Just to clarify, my solution is 100% Glide. 4 columns in a glide table to determine GMT, which could probably be condensed into 2 columns, to determine GMT or any other time zone (GMT+2 or GMT-2) if needed.

1 Like

@Jeff_Hager the medium format of date/time breaks the logic because it is localized and might include some words that are not “understood” by your logic (in my case it’s “tháng” - which means “month”).

A short format fixes it.

1 Like

Good to know. I’ll update it shortly. Looks like only the Local time needs to be in the short format?

1 Like

Yes, only the first one.

1 Like

Gvalero, to confirm:

My solution works 100% of the time so long as the app is active
Your solution works 93% of the time but still works when the app is not being used. :man_shrugging:

1 Like

I think he means 93% in that it covers all timezones except those rare ones that fall on the 1/2 hour or 3/4 hour, which could throw off the result by an hour for part of an hour. But only in those odd timezones.

1 Like

@ThinhDinh Ok, I changed the Local Date Time to the Short Format for the calculation and added a new math column so I could reformat it to the Medium Format for display purposes.

1 Like

@Jeff_Hager I can’t quite put my finger on why, but I just stumbled on this and it reminded me of you…

:rofl: :rofl:

2 Likes

:rofl: :rofl: Ha! That was great! That is date and time in a nutshell. Seems simple, but gets more complicated the more you think about it. Thankfully I don’t have to deal with anything nearly that complicated at work. We have servers in different time zones, but everything is synced to one time zone.

I wonder what kind of business that guy works at. Sure covers a lot of different users. :wink:

2 Likes

This just completed the last piece in the puzzle regarding adding Google calendar events for the user’s local time. Brilliant!!!

4 Likes

@Jeff_Hager Slight issue with the logic—it’s sending me to tomorrow. Ideas?

1 Like

I’ll take a look at the logic. I assume the calculated date in the table has that wrong day and that’s what’s being passed to the calendar?

Ya. Figured it out. I was using the start/end times to figure out the offset and not “now”. Works now!

2 Likes

Ahh, good. Made me nervous. :wink:

@Jeff_Hager - I implemented this method in one of my apps yesterday, and it was working perfectly. But just now I checked and I’m suddenly getting a GMT offset of -712 hours (it should be +8)

Any idea what might have gone wrong?

Must be something with crossing over to a different month??? 712 hours is 29.6 days and a lot of the math uses the day number. I’ll have to think about this.

mmm, but it’s still 30th September here (for another 2.5 hours), so Day(now) still returns 30…

Your formula looks different from what I have in the first post…but nothing is jumping out to me that would cause such a large offset.

If you break it down, what do you get for a value for each part?
What is your hour(gmt), day(gmt), hour(ldt), day(ldt) so I can hand calc it with your formula?

Let me make sure I’m using the correct version. I copied the formula from a copy I made some time ago, so it might be out of date.

But… I just loaded up your copyable app in my browser, and this is what I get:

  • Hour(gmt) => 5
  • Day(gmt) => 1
  • Hour(ldt) => 21
  • Day(ldt) => 30

Hour(gmt) and Day(gmt) are both wrong. They should be 30 and 13 respectively. So I guess that suggests that the Glide “trick” isn’t working the way we expect it to?