# Get gateway Time through scritping

**URL:** <https://forum.inductiveautomation.com/t/get-gateway-time-through-scritping/56298>\
**Category:** Ignition\
**Created:** [February 18, 2022, 6:23am UTC](https://forum.inductiveautomation.com/t/get-gateway-time-through-scritping/56298 "2022-02-18T06:23:45Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 18, 2022, 5:36pm UTC](https://forum.inductiveautomation.com/t/get-gateway-time-through-scritping/56298/13 "2022-02-18T17:36:03Z")

</div>

That _is the gateway time_. I promise. The complication is that `java.util.Date` objects represent (basically) epoch time - an always increasing count of (milli)seconds since some epoch:  
[https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Date.html](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Date.html)

If you don’t believe me, try this code in the script console:

```auto
from java.text import DateFormat
from com.inductiveautomation.ignition.client.gateway_interface import GatewayConnectionManager
from java.util import TimeZone

formatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG)
tz = GatewayConnectionManager.getInstance().getGatewayTimeZone()
formatter.setTimeZone(tz)
gwTime = system.tag.readBlocking(["[System]Gateway/CurrentDateTime"])[0].value
formatter.format(gwTime)
formatter.setTimeZone(TimeZone.getTimeZone("Europe/Paris"))
formatter.format(gwTime)

```

My gateway (and designer) are in America/Los Angeles, yet I get the following output:

```auto
>>> 
u'February 18, 2022 at 9:34:38 AM PST'
u'February 18, 2022 at 6:34:38 PM CET'

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/get-gateway-time-through-scritping/56298)._
