toDate expression value offset

ignition79
#1

We are running Ignition 7.9.10 and have found that the toDate expression function behaves differently when translating the same string based datetime value on machines in different timezones - guessing that is where this is coming from. We have one machine in Central which appears to translate the string into the correct datetime while a machine doing the same operation in Mountain against the same string offsets the hour by 1. There is no overload in the toDate function to say ignore timezone and even if so I can’t see how a string value would think it was supposedly from a different timezone.

We have to parse a date from an integer tag with a format of MMDDYY and a time integer with a format of HHMMSS and construct a datetime tag value from that which I have working with no issues. We just want to take that string and stick it in a date tag but don’t need it getting shifted for whatever reason. Maybe it’s Friday and I am overlooking something obvious here but can anyone explain this?

result

0 Likes

#2

Date objects actually hold their value as Unix milliseconds UTC and convert for display as needed. Converting strings to dates does the same, using the local timezone to get millis UTC.

0 Likes

#3

Ah ok, so because I am connected from a designer in Central to the Mountain gateway the shift is just for display of what I am seeing in the tag then? The value when seen locally or sent out over MQTT and historized on the other end would be captured correctly? Makes some sense but threw me. Appreciate the input Phil!

0 Likes