# Extracting historian data in different TZ?

**URL:** <https://forum.inductiveautomation.com/t/extracting-historian-data-in-different-tz/73085>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [May 1, 2023, 2:19pm UTC](https://forum.inductiveautomation.com/t/extracting-historian-data-in-different-tz/73085 "2023-05-01T14:19:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawn\_Rieger](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger/32/46336_2.png) [@Shawn\_Rieger](https://forum.inductiveautomation.com/u/Shawn_Rieger)\
**Post date:** [May 1, 2023, 2:19pm UTC](https://forum.inductiveautomation.com/t/extracting-historian-data-in-different-tz/73085/1 "2023-05-01T14:19:00Z")

</div>

I'm attempting to create a view that allows a user to select a start and end datetime from the datetime input picker in perspective. The gateway this is running on is in PDT. However, I set the perspective property for the timezone to be ETC. Still, whenever I use the datepicker I get PDT dates.

A few questions:

- I don't understand whats happening to the date in the image below. Perspective properties has zone set to EST. Is the picker itself in UDT? The picker is 4/30 12a, and the resulting DateTime object is 8 hours behind and says PST.
- Am I correct in assuming that Ignition/system.tag.queryTagHistory is taking the zone from my date object and converting it to UTC to query the DB?
- How can I get the datepicker and the resulting datetime to be in the same zone?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/1/9157ba31e232093a34c838245156c558da94b45f.png)

---

<div class="post-metadata">

**Author:** ![Shawn\_Rieger](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger/32/46336_2.png) [@Shawn\_Rieger](https://forum.inductiveautomation.com/u/Shawn_Rieger)\
**Post date:** [May 1, 2023, 2:25pm UTC](https://forum.inductiveautomation.com/t/extracting-historian-data-in-different-tz/73085/2 "2023-05-01T14:25:26Z")

</div>

Ok I just answered part of my question. Changing the picker format to 'lll z' gives me the zone as UTC. This is actually perfect. However, I don't always want the return to be in US/Pacific. How can I either force a zone for the resulting data or make sure I just get UTC back every time?

---

<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:** [May 1, 2023, 2:34pm UTC](https://forum.inductiveautomation.com/t/extracting-historian-data-in-different-tz/73085/3 "2023-05-01T14:34:31Z")

</div>

The date values in the result **are** UTC. Java's datetime type is UTC milliseconds, and is only **rendered** in a time zone at the point of display (string conversion).

If you want to render to a timezone that is not the active zone of the computer doing the string conversion, you will need to manually use java's timezone and localdatetime classes to apply the alternate zone.

Note that if you have jython render an object to string in any other way, including default string conversions, jython will use the active time zone.

---

<div class="post-metadata">

**Author:** ![Shawn\_Rieger](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger/32/46336_2.png) [@Shawn\_Rieger](https://forum.inductiveautomation.com/u/Shawn_Rieger)\
**Post date:** [May 1, 2023, 2:51pm UTC](https://forum.inductiveautomation.com/t/extracting-historian-data-in-different-tz/73085/4 "2023-05-01T14:51:07Z")

</div>

Phil, thank you. This is clear now. Time zones are, and always will be, my nemesis!
