Display Timezone Abbreviation

Hello, I can’t seem to figure out how to abbreviate the time zone in my time string. It currently reads (Eastern Daylight Time) and I would like to abbreviate it to EDT. Actually, I would prefer it to read EST. Can this be done? This is what I have so far:

[[Now.addHours(3).toLocaleTimeString().substring(0,4)]] [[Now.toLocaleTimeString().substring(8,10)]] [[Now.substring(34,)]]

Here is one way to do it. Basically, you want to grab the first (capitalized) character from each word in “(Eastern Daylight Time)” This could be compressed to one statement with some clever string embedding and slicing, but for ease, I separated to three steps:

  1. [[Now.slice(Now.indexOf('(')+1,-1)]]
    Grabs last part of Now string, from the left parenthesis but not including the parentheses. In your case, this should = “Eastern Daylight Time”.

  2. [[t.substr(0,1)]][[t.substr(t.indexOf(' ')+1,1)]][[t.substr(t.lastIndexOf(' ')+1,1)]]
    Takes first char, then char following the first space, then char following the last space. (‘t’ is a local variable pointing to the text on This. It could also be text on a hidden “temp” widget or a global variable.) In your case, this should now = “EDT”.

  3. [[Now.addHours(3).toLocaleTimeString().substring(0,4)]] [[Now.toLocaleTimeString().substring(8,10)]] [[This.text]]
    Prepends the time, using the first part of your formula above.

If you really want to force it to read “EST”, first realize that the ‘S’ stands for “Standard” as opposed to ‘D’ for “Daylight Savings”. So, you could wait a few weeks from now (in most parts of the United States) when Daylight Savings Time rolls forward to Standard Time, or you could lie about things and pretend it is Standard Time, by just appending “ST”. See last rectangle widget in attached file.

Timezone Abbr.rp (58.3 KB)

Here’s how it looks for my timezone on US west coast:

1 Like

This is just what I was looking for, thank you!!