We are receiving a timestamp value from MES in UTC format, which is being written to a memory tag of datatype DateTime. We have a tag value change script configured on this memory tag that processes the timestamp and writes it to another OPC tag of String datatype in the format MM/DD/YYYY.
However, we are observing a time difference of 11.5 hours in the OPC tag value. This discrepancy appears to be due to a time zone mismatch:
The Ignition gateway is configured to the America/Chicago time zone.
The system is based on IST (UTC +5:30).
Has anyone encountered a similar issue involving UTC timestamps, DateTime tags, and differing gateway/system time zones? Any guidance on best practices for handling time zone conversions or avoiding unintended offsets would be greatly appreciated.
Ignition's DateTime tags, and datetime values/timestamps throughout Ignition, use the java.util.Date data type. This type is fundamentally UTC. Any datetime parsing or printing automatically applies the JVM timezone.
If your MES is supplying UTC timestamps as strings, they will be naïvely interpreted in the gateway's timezone. Then when displayed in a project/client configured to IST, that already wrong timestamp will be butchered further. As you already see.
If you need to parse or stringify timestamps that are not in the Ignition gateway's timezone, you must use java's ZonedDateTime and ZoneId data types instead of Ignition's normal helpers.