How to retrieve gateway time and/or timezone offset in vision client?

I have a project that is deployed to multiple gateways. These gateways are on many different timezones and when I pull data back from the database server which is on the same server as the gateway I need to account for the timezone offset in the client. Originally the gateway I was working on was in UTC so to get the correct time to query I used the expression addHours({Equipment.Start Date.date},-getTimezoneOffset({Equipment.Start Date.date})) which would give me the date in UTC. Now I have a gateway that’s not in UTC and could have others in any number of timezones. My first instinct is that I could use the [System]Gateway tags but [System]Gateway/CurrentDateTime is just the same time that the [System]Client directory has. Basically my idea is when I do my timezone offset calculation I want to account for the offset of the client as well as the gateway but right now can’t seem to figure out a way to retrieve the gateway time or timezone offset from the client.

TLDR Just as the title says I need to get the gateway timezone offset from within a vision client.

You can get the gateway time and timezone from the system tag provider:
image

1 Like

How do I get the offset from that Timezone value though?

edit: I was able to figure it out. The following allowed me to get the offset for the Gateway timezone using the Timezone tag in the [System]Gateway directory.

from java.util import TimeZone
from java.util import Calendar
timezone = system.tag.readBlocking([’[System]Gateway/Timezone’])[0].value
timezoneCode = TimeZone.getTimeZone(timezone)
offset = timezoneCode.getOffset(Calendar.ZONE_OFFSET)/60.0/60.0/1000.0