# Return short date from MSSQL database query to avoid timezone conversion

**URL:** <https://forum.inductiveautomation.com/t/return-short-date-from-mssql-database-query-to-avoid-timezone-conversion/96969>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [October 8, 2024, 2:16pm UTC](https://forum.inductiveautomation.com/t/return-short-date-from-mssql-database-query-to-avoid-timezone-conversion/96969 "2024-10-08T14:16:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DNice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@DNice](https://forum.inductiveautomation.com/u/DNice)\
**Post date:** [October 8, 2024, 2:16pm UTC](https://forum.inductiveautomation.com/t/return-short-date-from-mssql-database-query-to-avoid-timezone-conversion/96969/1 "2024-10-08T14:16:47Z")

</div>

I am storing a short date value in my MSSQL database but this value is returned as datetime type from my named query. This becomes an issue when dealing w timezones west of me - the EventDate column dispays as the previous day to them. A simple way around this is converting my EventDate column to a string but then I lose table formatting on the Ignition side ☹. I can live with that solution I guess unless someone has success returning a short date value?

SQL data:  
 ![SQLTimestamp](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8ad085899bd9f18fd29c91066838381334de1344.png)

Ignition named query return:  
 ![IgnitionTimestamp](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c532e341f931f1ecc64bab740349a4fe8264c9a2.png)

---

<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 8, 2024, 2:20pm UTC](https://forum.inductiveautomation.com/t/return-short-date-from-mssql-database-query-to-avoid-timezone-conversion/96969/2 "2024-10-08T14:20:41Z")

</div>

Java doesn't have a date type without a time component. JDBC has no choice but to apply the DB connection timezone to produce a java object.

Your only solution in a multiple timezone application is to use UTC datetimes everywhere, or use data types that are inherently timezone-aware. Java defaults to the latter.

---

<div class="post-metadata">

**Author:** ![DNice](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@DNice](https://forum.inductiveautomation.com/u/DNice)\
**Post date:** [October 8, 2024, 2:25pm UTC](https://forum.inductiveautomation.com/t/return-short-date-from-mssql-database-query-to-avoid-timezone-conversion/96969/3 "2024-10-08T14:25:55Z")

</div>

Doh, not the answer I was hoping for, but makes sense... I suppose I will have to alter my database table and the data within.

---

<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 8, 2024, 2:29pm UTC](https://forum.inductiveautomation.com/t/return-short-date-from-mssql-database-query-to-avoid-timezone-conversion/96969/4 "2024-10-08T14:29:15Z")

</div>

Ignition will be happiest if you always deliver `DateTime2` through JDBC. Consider using views to CAST() where needed if DB redesign is too much trouble.
