system.historian.queryRawPoints returns Date or Timestamp depending on context

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?

My script:

logger = system.util.getLogger("testHist")
tag = "histprov:..."
startTime = system.date.parse("2026-10-07 13:11:33")
endTime = system.date.parse("2026-10-07 13:11:35")
data = system.historian.queryRawPoints([tag], startTime, endTime, columnNames=["mytag"], returnFormat="WIDE")

logMsg = "{2} data[0]={0}, type={1}".format(data[0]["t_stamp"], type(data[0]["t_stamp"]), source)
logger.info(logMsg)
print logMsg

Output when run on a button action:

button data[0]=2026-10-07 13:11:34.722, type=<type 'java.sql.Timestamp'>

Output when run in the console:

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)

I'm guessing when java.sql.Timestamp crosses the serialization/RPC boundary it becomes a java.util.Date, because it is a java.util.Date.

Is this an issue for you somehow?

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.

If you need precise control over a dataset's column types, use Ignition's DatasetBuilder.

The system.dataset.toDataset() function uses the data types of the first row.

Timestamp is a subclass of Date, explaining the compatibility when the column type is Date.

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.