Get gateway Time through scritping

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

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

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:

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