I have a script that calls system.historian.queryRawPoints. When invoked from Perspective, like on a button action, the t_stamp column is a java.sql.Timestamp. When invoked from the script console, it's java.util.Date. Is this expected behavior?
console data[0]=Wed Oct 07 13:11:34 PDT 2026, type=<type 'java.util.Date'>
I've noticed some similar weirdness in the console where system.db.execQuery returns a timestamp for columns of type timestamp with time zone and .runPrepQuery returns a Date. (PostgreSQL database)
JDBC tends to raw deliver as Timestamp, preserving sub-millisecond precision when present, but Ignition's SQL historian doesn't store sub-millisecond values. So it shouldn't be an issue for history. Might be an issue for named queries in Vision.
I'm trying to find the start/end times for some phases in a process. If I don't get a date from the historian, I fill it in with a known value. Like if the end time is empty, I assume the process is still ongoing and fill that in with system.date.now(). If a column of Timestamps contains a Date, it breaks:
from java.sql import Timestamp
rows = [
[Timestamp(system.date.toMillis(system.date.parse("2026-10-12 08:02:42.202"))), 13750.82733297348],
[system.date.parse("2026-10-12 08:46:27"), 44303.743373811245]
]
ds = system.dataset.toDataset(["t_stamp", "col1"], rows)
>>> TypeError: Unable to convert row 1, column 0 to type class java.sql.Timestamp
Interestingly, if you swap the order of the rows there, it succeeds and column 0 is Date. So it looks like it can implicitly cast Timestamp to Date but not vice versa.
Oh, thanks, I did not know about this class. There's a lot on the Java side of Ignition that I'm a bit intimidated to use.
Yeah, I wonder if this is relevant to the sort of behavior I was seeing (Timestamp); things like how the .equals() methods are not symmetric between the two classes and such:
Due to the differences between the Timestamp class and the java.util.Date class mentioned above, it is recommended that code not view Timestamp values generically as an instance of java.util.Date. The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance.