# EVENT\_TIMESTAMP in AUDIT\_EVENTS is text, not datetime

**URL:** <https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420>\
**Category:** Ignition\
**Created:** [June 3, 2021, 6:19pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420 "2021-06-03T18:19:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew.Meronek](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Andrew.Meronek](https://forum.inductiveautomation.com/u/Andrew.Meronek)\
**Post date:** [June 3, 2021, 6:19pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/1 "2021-06-03T18:19:53Z")

</div>

This is the “default” installation with the Sample\_SQLite\_Database that gets installed with Ignition 8.1.4. Why is this a text string instead of a “DATETIME” formatting as advised if one looks in the Config\>Security\>Auditing\>Edit\>Advanced Properties\>Timestamp Column description?

![24](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f6cd4b87c856bf0a34981bca9229a413ed40fc59.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 3, 2021, 6:43pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/2 "2021-06-03T18:43:37Z")

</div>

It uses `TEXT` because our translator defaults need to be updated, but it should still work fine. SQLite doesn’t _have_ any concept of datetimes as a type - there are [very few](https://www.sqlite.org/datatype3.html) actual datatypes in SQLite. Our translator currently uses TEXT, which relies on implicit string formatting (you can override the storage/retrieval format using a connection property), but at some point we’re planning to change that to INTEGER and storing epoch timestamps directly.

---

<div class="post-metadata">

**Author:** ![Andrew.Meronek](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Andrew.Meronek](https://forum.inductiveautomation.com/u/Andrew.Meronek)\
**Post date:** [June 3, 2021, 6:49pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/3 "2021-06-03T18:49:11Z")

</div>

Ah, OK. I discovered that while making a very simple Perspective table display that wasn’t doing a column date “render” - apparently, it’s not smart enough to know how to “render” a text string that represents an Epoch timestamp. This doesn’t seem to be all that pressing though, as I don’t see any reason to want to actually store, longer-term, Epoch dates this way.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [June 4, 2021, 4:30am UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/4 "2021-06-04T04:30:03Z")

</div>

And why only this table defaults uppercase everything?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 4, 2021, 2:39pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/5 "2021-06-04T14:39:39Z")

</div>

No one’s ever asked us to change it?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b1f6bd2ed6290a2068afed5d4c9b30949095ef19.png)  
It’s been that way for over a decade.

But, we can certainly change that default.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [June 4, 2021, 3:40pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/6 "2021-06-04T15:40:22Z")

</div>

Well, it sure would be ‘more normal’ to have all tables the same (lowercase).  
And also you don’t need to put table names and field names inside the quotation marks in queries…  
So, yes please, change it…

---

<div class="post-metadata">

**Author:** ![Andrew.Meronek](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Andrew.Meronek](https://forum.inductiveautomation.com/u/Andrew.Meronek)\
**Post date:** [June 4, 2021, 4:12pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/7 "2021-06-04T16:12:35Z")

</div>

I don’t particularly care about the case, as long as I know what it is when things are case-sensitive. Conventions in different environments can go both ways.

---

<div class="post-metadata">

**Author:** ![Rv.Batista](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rv.batista/32/3593_2.png) [@Rv.Batista](https://forum.inductiveautomation.com/u/Rv.Batista)\
**Post date:** [August 26, 2022, 2:38pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/8 "2022-08-26T14:38:55Z")

</div>

I'm in development and test phase of a project with Ignition 8.1, as development phase I'm using a SQLite database to test some features and in the gateway\>audit profile\>view log I'm getting the following error:

> java.sql.SQLException: Error parsing time stamp

There is a way to solve this without changing the database server?

---

<div class="post-metadata">

**Author:** ![Fred\_Morris](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@Fred\_Morris](https://forum.inductiveautomation.com/u/Fred_Morris)\
**Post date:** [November 12, 2022, 3:04am UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/9 "2022-11-12T03:04:44Z")

</div>

@Rv.Batista for whatever it's worth, I just ran into that too. In the Designer I can view it just fine in the _Database Query Browser_ except that the datetime isn't human readable. I'm using this for for example, the last 30 days:

```auto
SELECT datetime(EVENT_TIMESTAMP/1000, 'unixepoch'), ACTION
FROM AUDIT_EVENTS
WHERE EVENT_TIMESTAMP > (strftime('%s','now')-(86400*30))*1000

```

---

<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:** [November 12, 2022, 2:38pm UTC](https://forum.inductiveautomation.com/t/event-timestamp-in-audit-events-is-text-not-datetime/47420/10 "2022-11-12T14:38:44Z")

</div>

SQLite is a toy database. It has limited datatype support to focus on its primary purpose: hold _ **configuration data** _. (Not to mention being single-threaded--so prone to deadlocks in a multi-threaded environment.)

Don't use SQLite. If you need something free, use PostgreSQL or MariaDB.
