Are java datetime data types totally messed up in 8.0?

I had dozens of scripts using java datetime libraries and datatypes and nearly all of them will literally write the wrong time to tags or insert queries. If I print it to the console or convert it to a string, it writes the correct time. If I write it to a tag or database, it usually writes the correct time subtract 4-5 hours. Makes no sense and seems like a pretty massive bug in 8.0.

There are a lot of potential variables in what you’re describing - can you get in contact with support so we can have someone take a closer look at what you’re doing and what might be going wrong?

In short: to answer the question in the title, no, they are not to our knowledge - that doesn’t mean they couldn’t be, but this is the first report of this issue I’ve seen.

I upgraded from 7.9.10 on a new server with a restore of my gateway backup. I ran the new server in production to see if all was well. I upgraded to all the versions systematically to get to version 8.0.6. Now, running my new server, I get script faults saying my datetime conversions are leaving the decimal in the seconds and fail out. There has to be some changes.

no to mention, I can’t get my barcode scanners to work either…still working that issue as well

Caused by: org.python.core.PyException: Traceback (most recent call last): File “”, line 10, in File “C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\datetime.py”, line 1791, in strptime struct, micros = _strptime(date_string, format) File “C:\Program Files\Inductive Automation\Ignition\user-lib\pylib_strptime.py”, line 327, in _strptime raise ValueError(“unconverted data remains: %s” % ValueError: unconverted data remains: .228000

… 25 common frames omitted

here is the script that works fine in 7.9.10

for row in rs:
dt = row[“Date”]

Wed Nov 01 00:00:00 CDT 2017

date_format = "%a %b %d %H:%M:%S %Z %Y"
dta  = datetime.datetime.strptime(str(dt), date_format)
dbdatetime = datetime.datetime.strptime(str(dta), '%Y-%m-%d')
dbdatetimestr = str(dbdatetime)
dbdatetimestr = dbdatetimestr[:10]

Does this by chance happen to correspond to UTC time?

Uhm, those aren’t java datetime types, but Jython. Jython changed from v2.5 to v2.7. I’ve always found python date/time objects to be less than reliable in jython, even before v8.

Are you just extracting the date? Two options for you:

  1. dbdatetime should use strftime instead of strptime
dbdatetime = datetime.datetime.strftime(dta, '%Y-%m-%d')
  1. Ignition has all sorts of new date functions for us to use. :slight_smile:
for row in rs:
   dt = row[“Date”]
   dbdatetimestr = system.date.format(dt, 'yyyy-MM-dd')