# Request To Fix TimeZone Transformation

**URL:** <https://forum.inductiveautomation.com/t/request-to-fix-timezone-transformation/109077>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [July 29, 2025, 2:30pm UTC](https://forum.inductiveautomation.com/t/request-to-fix-timezone-transformation/109077 "2025-07-29T14:30:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 29, 2025, 2:30pm UTC](https://forum.inductiveautomation.com/t/request-to-fix-timezone-transformation/109077/1 "2025-07-29T14:30:47Z")

</div>

I know is a bit late to implement this (or to even request something).

But would be nice to have _correct_ TimeZones additions.  
I had an open ticket with ID #147059 if you wanna take a deeper look.

> **Brief explanation**
>
> ```python
> now1 = system.date.parse("30-03-2025 03:00:00", "dd-MM-yyyy HH:mm:ss")
> now2 = system.date.parse("30-03-2025 01:59:00", "dd-MM-yyyy hh:mm:ss")
> now3 = system.date.parse("30-03-2025 02:00:00", "dd-MM-yyyy hh:mm:ss")
> now4 = system.date.parse("30-03-2025 03:01:00", "dd-MM-yyyy HH:mm:ss")
> 
> print now1
> print now2
> print now3
> print now4
> 
> h1 = int(system.date.getTimezoneOffset(now1))
> h2 = int(system.date.getTimezoneOffset(now2))
> h3 = int(system.date.getTimezoneOffset(now3))
> h4 = int(system.date.getTimezoneOffset(now4))
> 
> print h1
> print h2
> print h3
> print h4
> 
> now5 = system.date.addHours(now1, -h1)
> now6 = system.date.addHours(now2, -h2)
> now7 = system.date.addHours(now3, -h3)
> now8 = system.date.addHours(now4, -h4)
> 
> print now5
> print now6
> print now7
> print now8
> 
> ```
> 
> ```python
> Sun Mar 30 03:00:00 CEST 2025
> Sun Mar 30 01:59:00 CET 2025
> Sun Mar 30 03:00:00 CEST 2025
> Sun Mar 30 03:01:00 CEST 2025
> 2
> 1
> 2
> 2
> Sun Mar 30 00:00:00 CET 2025
> Sun Mar 30 00:59:00 CET 2025
> Sun Mar 30 00:00:00 CET 2025 # <-
> Sun Mar 30 00:01:00 CET 2025 # <-
> 
> ```

Strange behaviour.

My request is simply having a nicer way (in scripting) of working with dates in UTC/Timezones.

---

<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:** [July 29, 2025, 2:38pm UTC](https://forum.inductiveautomation.com/t/request-to-fix-timezone-transformation/109077/2 "2025-07-29T14:38:57Z")

</div>

Use Java's `ZonedDateTime`. Ignition's datetime objects are `java.util.Date` which are fundamentally UTC under the hood, with no attached time zone. Which means they **always** use the time zone of the JVM when parsing or printing. When you manipulate them with `.addHours()`, you are not making a time zone correction, but are altering the underlying UTC value. Don't use `.addHours()` to make time zone corrections.

Read this entire topic:

> [@Ignition Perspective Page to show the client System date and time](https://forum.inductiveautomation.com/t/ignition-perspective-page-to-show-the-client-system-date-and-time/73265/8):
>
> Sure. I recommend [DateTimeFormatter.ofPattern()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html#ofPattern(java.lang.String)). But I would move the complexity to a project script module with a DateTimeFormatter instance with your preferred pattern saved as a top level variable. Like so, perhaps: from java.time import ZoneId from java.time.format import DateTimeFormatter defaultFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm") def zonedFormat(ts, zoneid, format=None): formatter = defaultFormatter if format is None else DateTimeFormatter.ofPattern(format) r…

Note also that `DateTimeFormatter` can parse, too.

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 30, 2025, 7:41am UTC](https://forum.inductiveautomation.com/t/request-to-fix-timezone-transformation/109077/3 "2025-07-30T07:41:21Z")

</div>

We use something similar to that in our projects to get the correct utc (at least I think).

But... wouldn't be great to be able to have something like this?  
`now() # returns current gateway time`  
`now_utc() # returns current utc time`  
`now_client() # returns current client time`  
And that the corresponding operations work with it's corresponding timezone.

I know that is asking too much, but let me dream

---

<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:** [July 30, 2025, 12:20pm UTC](https://forum.inductiveautomation.com/t/request-to-fix-timezone-transformation/109077/4 "2025-07-30T12:20:58Z")

</div>

> [@danielps1818](#):
>
> wouldn't be great to be able to have something like this?

Not possible with `java.util.Date`, which is what all of Ignition uses. 🤷‍♂️
