Ignition Perspective 8.1.20 Binding the date/time of gateway

Happy Holidays to all! My task was to compare the gateway date/time to a CompactLogix L330ER processor Date/Time so we can alarm on any time sync issues to maintain the reporting and transactions all triggering correctly. My trouble is getting the value of the Gateway tag "CurrentDateTime" to parse correctly. In the development tag browser I see the "CurrentDateTime" values correctly. But when binding this tag to a label, the label string value looks like "2022-12-16T15:38:32:099Z" Could not find an example of this task...
What would be the correct expression parse the Gateway HOUR, Gateway MINUTE values to trigger a boolean alarm. I have resolved getting the HOUR and MINUTE of the PLC parsed into a couple tags. Thank you for reading this post...

You don't need to parse the CurrentDateTime tag. It already has a 'Date' type, which you can programmatically pull certain values from, with expressions or scripting.

1 Like

Thank you

Note that a Logix processor's WallClock 64-bit .currentValue, when in an LINT, is UTC microseconds. Ignition's datetime objects are java.util.Date under the hood, which are built on UTC milliseconds. So, scaling by 1000 will get you precisely comparable values.

(See all of the various date/time conversions among Ignition's expression functions and scripting functions to get the value you need. Do not use string parsing or string formatting for these kinds of tasks.)