Substring Widget: Workaround for timezone lack of configurability

  • japeacecamp
    Asked on June 30, 2024 at 4:13 PM

    I'm trying to design a workaround for the local timezone lack of support. I need to change conditions on my form based on my local time (PT) and not the visitors time zone. Right now all calculations defaults to the visitors time on their computer.

    I see I can get the users timezone using the "Get Visitor Location Widget". But I need to extract the time zone from that as a number. i.e. -0700. I can make a condition that will set a number field based on whether the number exists in that field, i.e. if "Get Visitor Location Widget" included -0700, then I can set a NUMBER field to -0700. But I would have to do that individually for every time zone! That's a lot of work. Is there way to just extract the -0700 from the text output of "Get Visitor Location Widget"? I don't see any text functions available in the calculations widget like they have in Microsoft Excel.

    As an alternative, is there a way to use your server time? That seems to be a constant, and I understand that it's set to EST. If I could include that in my calculations, that would be way easier!

    Thanks for your response.

  • Neal JotForm Support
    Replied on June 30, 2024 at 4:48 PM

    Hi Ray,

    Thanks for using Jotform. You can definitely use the Substring Widget that will let you extract specific characters from the Get Visitor Location widget. Let me show you how:

    1. In Form Builder, add both the Get Visitor Location widget and the Substring widget.
    2. Once you have the Get Visitor Location widget set, get the Field ID which can be located on the Properties Settings of the Get Visitor Location widget.
    3. Paste the Field ID to the Substring Widget's Source Field ID.
    4. Enter the Start and End characters of the text you wish to extract. For the time zone, it would be 19 as the Substring Start then 24 as the Substring End.

    Substring Widget: Workaround for timezone lack of configurability Image 1 Screenshot 20 Give it a try and let us know how it goes.

  • japeacecamp
    Replied on June 30, 2024 at 5:20 PM

    Thanks, I'll try it. Any way to retrieve your server time as an accurate constant?

  • Mafe_M JotForm Support
    Replied on June 30, 2024 at 6:39 PM

    Hi Ray,

    Jotform doesn't have a direct tool to display current server time, but you are allowed to use third-party codes for that. Jotform's servers use US Eastern Standard Time (New York time), by the way. The closest way is to use the substring widget.

    Keep us updated and let us know if you need help.

 
Your Answer