šŸ•’ System/GMT Time - Solved!

@Jeff_Hager just one more point to considerā€¦ when we take each users local time and use that to determine GMT, we are relying on the fact that all of our users clocks will be correct. Whilst thatā€™s probably generally true - as most devices will be set by default to use NTP - I donā€™t think it can be guaranteed 100% of the time. And when you are dealing with race conditions, it only takes one user to be a minute or two slow and another to be a minute or two fast - and everything flies out the window.

This again is where I think using an external source as a reference point is key. It doesnā€™t even have to be GMT, it could be anything - Mickey Mouse time, whatever. The important thing is that itā€™s a single point of reference.

Iā€™ll shut up now and go to bed :joy:

2 Likes

This is fantastic, Jeff! Iā€™ll test with an app that Iā€™m using currently that depends on calculating system time and get back to you. Well done brother!

1 Like

My results from the UK. Itā€™s correct because weā€™re in BST right now. This is a great piece of work @Jeff_Hager. I think youā€™re right in your assumptions about JS and browser capabilities. I canā€™t think it would be too difficult for @Mark to add to Glide somehow.

1 Like

Itā€™s good for France.
Good job @Jeff_Hager

1 Like

I think Iā€™ll have to make some additional updates to account for those Aussies that like to throw time around like they have no wuckas. Geez, 30, 45 (kinda), and 00 minutesā€¦really? :wink:

4 Likes

This is great. I integrated some services in my app that automatically writes GMT/PST alongside the timestamp that comes back, and I usually convert that to a date/time column like what you did here so it converts to the signed-in userā€™s timezone, it is good.

However it never occurred to me about this offset time, thanks for putting all the work into this.

I am thinking about an Integromat flow where you can use this offset time to do a weekly reminder. My clientā€™s users need to be reminded about doing an in-app quiz and they can choose a date of the week to be reminded. I have done that already, but itā€™s stressing me about a timezone problem that this may fix.

In Integromat, I can only run it based on the timezone chosen in the account (in my case itā€™s Mexico City, GMT-5). If I run that scenario 7am everyday to check for every row in the Sheet and sends an email if the reminder weekday is the same as Integromatā€™s ā€œcurrentā€ weekday, timezones which at that point are not in the ā€œcurrentā€ day wouldnā€™t have their reminder delivered correctly.

Do you have any further thoughts about this use case?

2 Likes

Fixed! Now this should account for timezones that fall into half hour or 3/4 hour offsets. Also fancied up the display of the offset a little.

1 Like

Wow, I guess I didnā€™t realize that this would work for other timezones. So essentially, if you append the timezone code, such as PST, PDT, MST, MDT, CST, CDT, EST, EDT, etc. or if you append +0, +5, +8, etc. (not sure about negatives or decimals), or better yet, GMT+5, GMT+8, GMT-5, GMT-8, GMT+12:30, etc. after any date/time, it will lock that date time to that timezone, and whatā€™s displayed to the user will adjust accordingly to the userā€™s local time. This could be a huge advantage for creating meetings or appointments that cross timezones as every user would see a time according to their local timezone.

Iā€™d probably need a better visual, but I would think that you may be able to convert any user entered date/time to or from GMT-5., so if I understand correctly, it may work for you.

3 Likes

Currently the flowā€™s like this:

Every 7am Mexico City time I run through all the rows in the Profiles sheet, then pickout only the ones that has the same ā€œReminder weekdayā€ as the ā€œNowā€ weekday of Integromat, then send them emails.

With your method here, Iā€™m thinking about an extra offset column to let me calculate the ā€œcurrentā€ time of each user, in the Sheet. I would run the scenario every hour to check for rows that have the ā€œcalculatedā€ time as 7am, for example.

So it comes from sending everyone emails at 7am Mexico City, to being able to send emails at 7am their time.

Yeah, I think that would work. Trying to run it through my head, but Iā€™m sure thereā€™s a lot of parts to it.
So basically you are figuring out the userā€™s current day. I fall into the same time as Mexico City. So for example, I assume you are 12 hours ahead. I get confused with the international date line, but as of right now you are a day ahead from me, but at 7:00am my time, we would still be within the same day. With that I wonder if you would have a problem at all. But ignoring that, lets say your process runs in the next half hour and you picked Thursday as your day. As it stands, it would not pick up your day because Mexico is still on Wednesday. So if you had your offset of +7 hours combined with the -5 for Mexico, you would have a +12 hour offset, so you would need to add 12 hours to Mexico local time and then check the weekday of that calculated date. In theory, I think it should work out pretty well.

Some timezones have daylight savings so the time shifts by an hour, so Iā€™m not sure if that would cause some rare situations where the calculated date would jump by an extra hour, but hopefully that wouldnā€™t be much of an issue.

3 Likes

Thanks for thinking through Jeff! Another great method from our Chuck Norris!

1 Like

Finally had a chance to study this. Absolutely brilliant.

1 Like

LOVE IT! Iā€™ll have to set aside some time to test this in one of my apps.

1 Like

@Jeff_Hager, here is my solution for this issue although I think, both solutions complement each other.

In my case, I have a Google Sheet with a timezone XX and I try to have on APP the time based on that GS timezone and not the user timezone which is used by Glide.

If my GS is using ā€œEurope/Berlinā€ timezone (GMT +01) and my APP has multizone users around the world (USA, Brazil, Spain or Venezuela) buying tickets or making a booking Iā€™m going to need to have transactions timestamp based on my GS (Berlin) always to have a real order and know the sales queue correctly (based on time).
Otherwise, If I use the Glide time (based on device/user timezone) my transaction log will be hard to understand and sort out.

The key in my case is write and use the GS timezone into a cell using the Now() function. This will rule everything regarding time and date. Itā€™s the only thing you will need to use in your GS.

image ā€¦ . image

Later, in GDE you will have these 3 new columns with a simple logic/math:

  1. Glide Time (Local Time)
    image

  2. Time Offset

  3. new Glide Time (based on GS Timezone)

And trying to replicate your APP demo :innocent: , you can see what happens on my APP verifying several timezones and times:

https://glide-time.glideapp.io

In my case, Iā€™m in Venezuela and have -6 hr with Berlin and @Mark_Turrellā€™s house :wink:.
With it, any transaction done by me (or any user) from APP will be logged using Berlinā€™s time instead of local time (user timezone).

Although few people and in few times the GSā€™ timezone will be changed frequently, I created a choice list to carry out it automatically and test better my solution (using a small script as well). None of you needs to have it on your APP to get this functionality, this is not mandatory.
Again, I created the timezone choice list and my script to make this APP demo more friendly only.

I hope it helps anyone.

Saludos!.

6 Likes

yeah thatā€™s essentially what @Simon_Hill did:

Itā€™s a nice simple solution for determining users timezones, but again I donā€™t believe it helps with the ā€œGreat Agent Raceā€

1 Like

@Jeff_Hager

One word sums up my thoughts about your solution - ā€˜Geniusā€™

I just want to say the value you bring to the community is absolutely amazing.

I hope you realise how much we appreciate your insight and wisdom and the positive impact your solutions play in building our apps.

Here is a virtual :beer: or :coffee:

6 Likes

Hola @Darren_Murphy

Yes, it looks like the @Simon_Hillā€™s idea but there is one difference:

Simon needs to send any value previously to his GS to update the time and later use it in any operation. If your APP has a Pro plan, it isnā€™t mandatory because of Glide will update APP from GS each 4-5 min (including everything associated to Now() function).
But even using a Pro plan, Simon still needs to send a value to GS (via an Increment action) to avoid losing up to 4-5 min caused by Glideā€™s automatic update.
My solution doesnā€™t have this problem with a Pro Plan. Once APP has read the time from cell, the new Glide time is updated every 10 sec by Glide internally and automatically.

Instead, if your APP uses a free plan, you will need to do something like what Simon does but there is a time window about 1 hr in where you still have the synchronized time without problems.

Later I will go over your crazy ā€œagents raceā€ :upside_down_face:

Saludos amigos!

3 Likes

Just to clarify, whatever your plan so long as you change something in the GS then the entire sheet will be updated instantly. I donā€™t use ā€˜incrementā€™ anymore. Instead I use ā€˜set columnā€™ and push the current Date/time into any redundant cell. Itā€™s pretty easy to add these ā€˜trip wiresā€™ into any app so that common user actions automatically trigger a GS time update.

1 Like

Thatā€™s a good solution too. I was going to ask about how the sheet time was updated in glide, but now that makes sense with the background refresh, or setting a value to resync. So in theory, you should never have a time drift of more than 5 minutes, so your rounded offset calculation will always fall to the nearest hour.

Just something to be aware of, there are those rare timezones that differ by an additional 30 or 45 minutes. May not matter much depending on the scope of your app, or where the userā€™s are primarily located, but something to consider.

1 Like

Thank you! Iā€™ll take both. :wink:

Glad to help. Some of this stuff is fun to try to figure out.

1 Like