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?
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?
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.
Phil, thank you. This is clear now. Time zones are, and always will be, my nemesis!