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

**URL:** <https://forum.inductiveautomation.com/t/how-to-retrieve-gateway-time-and-or-timezone-offset-in-vision-client/38997>\
**Category:** Ignition\
**Tags:** ignition80, vision\
**Created:** [September 23, 2020, 8:23pm UTC](https://forum.inductiveautomation.com/t/how-to-retrieve-gateway-time-and-or-timezone-offset-in-vision-client/38997 "2020-09-23T20:23:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DerekUlee](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@DerekUlee](https://forum.inductiveautomation.com/u/DerekUlee)\
**Post date:** [September 23, 2020, 8:23pm UTC](https://forum.inductiveautomation.com/t/how-to-retrieve-gateway-time-and-or-timezone-offset-in-vision-client/38997/1 "2020-09-23T20:23:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [September 23, 2020, 8:26pm UTC](https://forum.inductiveautomation.com/t/how-to-retrieve-gateway-time-and-or-timezone-offset-in-vision-client/38997/2 "2020-09-23T20:26:17Z")

</div>

You can get the gateway time and timezone from the system tag provider:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/a/5a4f2b999dc1eefcac8759217479c5568de5be93.png)

---

<div class="post-metadata">

**Author:** ![DerekUlee](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@DerekUlee](https://forum.inductiveautomation.com/u/DerekUlee)\
**Post date:** [September 23, 2020, 8:39pm UTC](https://forum.inductiveautomation.com/t/how-to-retrieve-gateway-time-and-or-timezone-offset-in-vision-client/38997/3 "2020-09-23T20:39:21Z")

</div>

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
