# Reading/writing to SQL server time zone aware

**URL:** <https://forum.inductiveautomation.com/t/reading-writing-to-sql-server-time-zone-aware/32898>\
**Category:** Ignition\
**Tags:** vision, perspective\
**Created:** [March 6, 2020, 7:30pm UTC](https://forum.inductiveautomation.com/t/reading-writing-to-sql-server-time-zone-aware/32898 "2020-03-06T19:30:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 6, 2020, 7:30pm UTC](https://forum.inductiveautomation.com/t/reading-writing-to-sql-server-time-zone-aware/32898/1 "2020-03-06T19:30:40Z")

</div>

Using SQL server for logging to custom tables, how does everyone handle timezones?

I would like to use the datetimeoffset type, but ignition didn’t recognise it last time I tried to use it, even after updating the jdbc driver. Then I tried logging to datetime in UTC time zone by converting logged datetimes in python first. But then I don’t know how to convert it back again when reading it back at the client, as it can’t be done in the query as this is executed on the sql server which may have a different time zone… I don’t want to be post-query processing the results in python

For context, I’m logging process batch runs and capturing the stats from each run. But we live in an area with DST and so this ruins logs when it changes over.

---

<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:** [March 6, 2020, 9:29pm UTC](https://forum.inductiveautomation.com/t/reading-writing-to-sql-server-time-zone-aware/32898/2 "2020-03-06T21:29:36Z")

</div>

I’ve been lucky to avoid this issue… by using PostgreSQL. Which has always had excellent support for `timestamptz` columns (the behavioral match for SQL Server’s datetimeoffset, but only to microsecond precision).

(TimestampTZ columns, like Datetimeoffset, use raw storage in UTC, and convert to/from any connection’s timezone. Which yields a java.sql.Timestamp with exactly the right microseconds UTC. And Ignition happily carries those to TZ-aware clients correctly.)

{Sorry, non-responsive to your question. But I don’t know that there is an answer to your question. Which, for me, prompts a search for alternatives.}
