Working Across Time Zones/Calculating GMT

I'm looking to make some time-based snippets, however I work with a team that is across multiple time zones so that adds complexity. I discovered that {time: Z} exists even though it doesn't seem to be documented anywhere.? I cobbled this together, which seems to work for folks to the west of GMT.

{time: h:mm:ss A; shift={=(60*substring({time: ZZ}, 2, 2))}m}

I could then use this to make all my if statements based on the shifted time, but that seems more complex than need be.

Is there a better way to be doing this? Ideally I'd like to just be able to say - if: it is 5p ET then do X (regardless of the time zone the computer is in)

Hey, Kevin. I don't know if this helps, but I do something similar. In your case, if I needed to always make conditionals on Eastern Time, I would use this command:

{urlload: https://www.google.com/*****search?q=eastern+time; done=res -> ["ET"=extractregex(res, "<div class="gsrt vk_bk FzvWSb YwPhnf" aria-level="3" role="heading">(.+?)")]}

***Delete those stars in the link

It basically searches in Google what the current time in ET is, and stores the result in the variable "ET".

You can later add {=ET} and the snippet will show you the time it extracted. With that then you could make your conditionals.

Keep in mind the folder you have the snippet in will request you to allow access to Google.

3 Likes

Doesn't seem like your snippet works. When I try to input it by copy/pasting + removing the *s (connected folder enabled) I get this error:

Invalid formula for "done" - unexpected "g" in ... ="gsr..

Can you share the functional one with me?

@Kevin_Roberts

Something like this should work:

{note: preview=no}
{timezoneoffset=extractregex({time: Z}, ".")&((extractregex({time: Z}, "\d+")*60)+(extractregex({time: Z}, ":(\d+)")))}
{endnote}
Your time zone is {time: Z} UTC and your current local time is {time: HH:mm} (24-hour clock).

The task should be done at {formtext: name=tasktime; default=13:30; cols=7} UTC (24-hour clock), which is {time: h:mma; at={=tasktime}; pattern=H:mm; shift={=timezoneoffset}m} your local time.

*EDIT

Here's one more snippet to help you convert your local time to UTC:

{note: preview=no}
{timezoneoffset=extractregex({time: Z}, ".")&((extractregex({time: Z}, "\d+")*60)+(extractregex({time: Z}, ":(\d+)")))}
{switch=timezoneoffset*-1}
{endnote: trim=right}

Local time to convert to UTC: {formtext: name=local; default={time: HH:mm}; cols=7} (24-hour clock)

{time: h:mma; at={=local}; pattern= H:mm} local time is {time: h:mma; at={=local}; pattern= H:mm; shift={=switch}m} UTC {if: {time: MMDD} > {time: MMDD; at={=local}; pattern= H:mm; shift={=switch}m}}(previous day){endif}.

I recommend you use UTC as a standard time for setting up the times, because it saves you from having to juggle daylight saving time.

1 Like

@Kevin_Roberts

One more thing, the interactive snippets I shared with you above can be copied directly to your dashboard with a few clicks.

Here's how you can do it:
GIF - Copy Snippets to Text Blaze

Additionally, we've just published a video on how you can create these interactive snippets yourself in the forum when you need help.

You can check it out here:

Let me know if you have any other questions :slight_smile: