# Displaying current times in 2 Time Zones

**URL:** <https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 29, 2024, 11:42am UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069 "2024-03-29T11:42:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [March 29, 2024, 11:42am UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069/1 "2024-03-29T11:42:47Z")

</div>

Hi All.

I am in Melbourne, Australia. We are currently in Australian Eastern Daylight Time, AEDT, which is currently UTC+11.

While Brisbane, Australia is in the Australian Eastern Standard Time (AEST), which is UTC +10.

In a couple of days AEDT will be over and we will fall back to AEST.

Now, I need to display current date/time in both Melbourne and Brisbane. Displaying local time is fine. But displaying Brisbane time is giving me grief.

I tried addHours(now(),10) but the string is converted to local time automatically.

How can I display Brisbane AEST time? Is there an Ignition method?

Thanks.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 29, 2024, 12:05pm UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069/2 "2024-03-29T12:05:21Z")

</div>

> [@Sasi\_Rai](#):
>
> addHours(now(),10) but the string is converted to local time automatically.

What component are you displaying this in? `addHours` returns a date, not a string.

---

<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 29, 2024, 1:23pm UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069/3 "2024-03-29T13:23:22Z")

</div>

Don't do arithmetic on the date object. Use manual formatting for a desired time zone, as described here:

> [@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…

Ignition datetime objects are instances of `java.util.Date`, and are fundamentally UTC. That is, they have no timezone of their own, but display in whatever time zone the JVM is using. That means they can be sent across a network and remain true to the instant in global time with which they were created, regardless of time zone.

The implication is that you should always think about these objects as UTC. Another, more elaborate discussion:

> [@Ignition Timezone of the server](https://forum.inductiveautomation.com/t/ignition-timezone-of-the-server/80848):
>
> Hi guys! My main server at the Michigan, an it's time zone is Chicago. However, my plants are ate the different time zones. I'm already have a lots of widgets that uses function now() for Tag History requests. In expression now() always return server time zone time. I tried to change Project-\>Project Properties-\>Designer-\>Timezone Behavior as well as Project-\>Project Properties-\>General-\> Project Timezone. But this has zero influence on function now(). Does anyone has similar problem?

---

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [April 1, 2024, 11:15pm UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069/4 "2024-04-01T23:15:15Z")

</div>

Hi Justin.  
Yup, agreed. The returned date from the expression addHours(now(), 10) is written to a tag. So, the tag gets a string representation of the date object.

---

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [April 2, 2024, 10:27pm UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069/5 "2024-04-02T22:27:01Z")

</div>

Thanks pturmel.

---

<div class="post-metadata">

**Author:** ![Sasi\_Rai](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sasi\_Rai](https://forum.inductiveautomation.com/u/Sasi_Rai)\
**Post date:** [April 2, 2024, 10:43pm UTC](https://forum.inductiveautomation.com/t/displaying-current-times-in-2-time-zones/88069/6 "2024-04-02T22:43:37Z")

</div>

Dear All,

For anyone interested, here's what I have done:

- followed pturmel's posts given above.
- massaged the example script to read current time, convert it to required time zone, format it and write the object into a string tag.
- Added a script in the Project Library
- From the Gateway Events, called the script every minute

This is working fine, so far.
