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

**URL:** <https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 29, 2026, 10:37pm UTC](https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669 "2026-10-29T22:37:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [October 29, 2026, 10:37pm UTC](https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669/1 "2026-10-29T22:37:12Z")

</div>

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:

```python
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:

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

```

Output when run in the console:

```python
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)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 29, 2026, 11:31pm UTC](https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669/2 "2026-10-29T23:31:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 30, 2026, 12:06am UTC](https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669/3 "2026-10-30T00:06:17Z")

</div>

> [@Kevin.Herron](#):
>
> an issue

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.

---

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [October 30, 2026, 12:08am UTC](https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669/4 "2026-10-30T00:08:04Z")

</div>

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:

```python
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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 30, 2026, 12:26am UTC](https://forum.inductiveautomation.com/t/system-historian-queryrawpoints-returns-date-or-timestamp-depending-on-context/117669/5 "2026-10-30T00:26:42Z")

</div>

If you need precise control over a dataset's column types, use Ignition's [DatasetBuilder](https://sdk.inductiveautomation.com/javadoc/ignition83/8.3.8/com/inductiveautomation/ignition/common/util/DatasetBuilder.html).

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`.
