# How to set Timezone in reporting jython for data

**URL:** <https://forum.inductiveautomation.com/t/how-to-set-timezone-in-reporting-jython-for-data/117625>\
**Category:** Ignition\
**Created:** [October 27, 2026, 3:00pm UTC](https://forum.inductiveautomation.com/t/how-to-set-timezone-in-reporting-jython-for-data/117625 "2026-10-27T15:00:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mperlman](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mperlman](https://forum.inductiveautomation.com/u/mperlman)\
**Post date:** [October 27, 2026, 3:00pm UTC](https://forum.inductiveautomation.com/t/how-to-set-timezone-in-reporting-jython-for-data/117625/1 "2026-10-27T15:00:01Z")

</div>

For a specific subset of regular reports, I need the scripting to kick out data in a fixed offset time zone. (UTC would be fine, UTC -x would be marginally better.)

The gateway is correctly configured to use daylight savings so the system works as needed for display & local control interaction. That also works for the majority of reporting.

I've tried pulling the date and trying to return it with system.date.format(foo,"yyyy-MM-dd HH:mm:ss X="-0700"), but that just shows the existing gateway timezone and then my input.

Similar with other variations of single quotes, no quotes, -7, and substituting Z instead of X based on the [simple date format](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/SimpleDateFormat.html). I'm sure I am missing something silly, but I cannot find how to get the system to report data in my desired timezone.

This is just to display in a report & kick to Excel format. If it can simply show the data in UTC, I can manually manipulate hours if necessary.

Since this is within a dataset, I also will need to then append it to a new data column. I think I have correctly set that up:

from java.util import Date && system.dataset.addColumn(PDS,foo,"NewTime",Date)

Thank you.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 27, 2026, 4:27pm UTC](https://forum.inductiveautomation.com/t/how-to-set-timezone-in-reporting-jython-for-data/117625/2 "2026-10-27T16:27:38Z")

</div>

_java.util.date_ is fundamentally UTC under the hood. If you need a specific time zone, use java.time.ZonedDateTime

```python
from java.time import ZoneId
from java.time.format import DateTimeFormatter

# java.util.date
now = system.date.now()

# java.time.ZonedDateTime
localTime = now.toInstant().atZone(ZoneId.of('US/Pacific'))

# formatted string
formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd HH:mm:ss')
formattedTime = localTime.format(formatter)

print 'now: {} {}'.format(now, type(now))
print 'newTime: {} {}'.format(localTime, type(localTime))
print 'formattedTime: {} {}'.format(formattedTime, type(formattedTime))

```

Output:

```plaintext
now: Tue Oct 27 12:24:38 EDT 2026 <type 'java.util.Date'>
newTime: 2026-10-27T09:24:38.683-07:00[US/Pacific] <type 'java.time.ZonedDateTime'>
formattedTime: 2026-10-27 09:24:38 <type 'unicode'>
>>> 

```

---

<div class="post-metadata">

**Author:** ![mperlman](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mperlman](https://forum.inductiveautomation.com/u/mperlman)\
**Post date:** [October 27, 2026, 4:33pm UTC](https://forum.inductiveautomation.com/t/how-to-set-timezone-in-reporting-jython-for-data/117625/3 "2026-10-27T16:33:39Z")

</div>

Perfect, thank you Jordan!

One of these years I'll figure out if I need to be learning java or python... and then still fail as I'm at best a PLC person who ocassionally hits SCADA.

---

<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 27, 2026, 4:38pm UTC](https://forum.inductiveautomation.com/t/how-to-set-timezone-in-reporting-jython-for-data/117625/4 "2026-10-27T16:38:15Z")

</div>

> [@mperlman](#):
>
> java or python

Both. Jython is python syntax with Java libraries.
