Tag value change script

When i use datetime.now() in the script console it shows my local time.
But when it runs on an event tag script value change it uses UTC time.

The script console is the same as the System, Current Time tag.

I don’t know why it would be different as datetime.now() with no arguments defaults to local system time.

Don’t use jython’s datetime in Ignition. Use system.date.now() and the date manipulation functions provided by Ignition. Ignition is java under the hood, and therefore you need instances of java.util.Date to have consistency. Jython’s datetime does not leverage java types, and is particularly bad at timezones.

1 Like