# Scheduled Reports offset due to daylight savings

**URL:** <https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [March 15, 2022, 6:22pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227 "2022-03-15T18:22:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Boehm](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@Brian\_Boehm](https://forum.inductiveautomation.com/u/Brian_Boehm)\
**Post date:** [March 15, 2022, 6:22pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/1 "2022-03-15T18:22:55Z")

</div>

Hello, I have came into a weird issue due to daylight savings, In short I have a scheduled report that gets sent at 12 am everyday and shows the prior data for a 7 day period. Before Daylight savings I had no issue with this report schedule. After Daylight savings I’ve been having issues where it seems the data will try to grab info at 1 am for dates past daylight savings time. Does anyone know if there’s a fix to this?

 ![report pulled at 3 15 2022](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/d/9d078b791bae7ec6e8ae7ffb097215cdc78c74c2.png)  
 ![report pulled at 3 14 2022](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c0933a1309f3ed77f71807e8d2fd965ab7313c59.png)

---

<div class="post-metadata">

**Author:** ![Brian\_Boehm](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@Brian\_Boehm](https://forum.inductiveautomation.com/u/Brian_Boehm)\
**Post date:** [March 15, 2022, 6:28pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/2 "2022-03-15T18:28:17Z")

</div>

> [@Daylight savings](https://forum.inductiveautomation.com/t/daylight-savings/44751):
>
> I am running Ignition 8.1 Vision module. This is a solved issue. I post it here to help anyone who has a similar issue. When daylight savings time came into effect (March 14 2021), the system where the gateway is installed changed the time accordingly but my ignition project did not. The gateway itself did not seem to acknowledge the change. I solved by a simple reboot of the machine where the gateway was installed. After that any open client sessions had to be closed and opened again to corre…

I did find this, but i do not have the luxury of restarting my gateway/server rn due to the site in constant operation

---

<div class="post-metadata">

**Author:** ![jay](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jay](https://forum.inductiveautomation.com/u/jay)\
**Post date:** [March 15, 2022, 6:39pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/3 "2022-03-15T18:39:37Z")

</div>

It looks like the data is coming from the tag historian with an interval of 1440 minutes and a start time set to 00:00. Unfortunately, that won’t work twice a year if you are in a DST time zone.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [March 15, 2022, 11:30pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/4 "2022-03-15T23:30:10Z")

</div>

I think its more work than its worth, but you could use script query to go through your history query and twice a year alter your time stamps for that one run of the report. You would just be faking it out for DST changes. You would also need to alter you start and end parameters to be accurate.

---

<div class="post-metadata">

**Author:** ![Brian\_Boehm](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@Brian\_Boehm](https://forum.inductiveautomation.com/u/Brian_Boehm)\
**Post date:** [March 16, 2022, 1:04pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/5 "2022-03-16T13:04:07Z")

</div>

I have my query for my tag historian set to 24 hours, I wish I could set it to 1 day I would think that could resolve the issue. This is just wishful thinking though.

At the moment I am going to alter my timestamps so it will work for this time period I am thinking by the 21st the Issue will resolve itself and I will be able to set my parameters back to the original format.

Sadly neither of these seems like end all be all solutions.

---

<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 16, 2022, 1:20pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/6 "2022-03-16T13:20:45Z")

</div>

I’m pretty sure that `system.date.addDays()` will give you a 23 hour or 25 hour interval when crossing a time change.

---

<div class="post-metadata">

**Author:** ![Brian\_Boehm](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@Brian\_Boehm](https://forum.inductiveautomation.com/u/Brian_Boehm)\
**Post date:** [March 16, 2022, 2:30pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/7 "2022-03-16T14:30:33Z")

</div>

It seems system.date.adddays is a scripting feature. I am using tag historian query with a interval of 24 hours query my data. Do you believe writing script that query my tag history using system.date.adddays() could work better?  
I haven’t tried querying data using scripting yet. I will have to research a bit to accomplish this.

I assumed my issue is related to my start and end date parameters which is expression based. I have used dateArithmetic(now(0), -1, ‘day’) and addDays(now(0), -1). to see if this helps with no progress.

---

<div class="post-metadata">

**Author:** ![Brian\_Boehm](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@Brian\_Boehm](https://forum.inductiveautomation.com/u/Brian_Boehm)\
**Post date:** [March 16, 2022, 4:02pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/8 "2022-03-16T16:02:16Z")

</div>

[system.tag.queryTagHistory - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)](https://docs.inductiveautomation.com/display/DOC81/system.tag.queryTagHistory)

I’ve been reading the set up of how to query tag history but it seems I run into the same issue i have currently with the IntervalHours, Intervalminutes, and intervalseconds. Since those values are looking for a integer in either of those 3 criteria to query my data over a 24 hour/1 day period.

When setting up scripted query to reports is there another way to get tag historian data? I’m not seeing many options online.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [March 17, 2022, 3:32am UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/9 "2022-03-17T03:32:26Z")

</div>

You can have a script data source in addition to your tag history data source.  
This is a basic example, you would need to check which timestamps need adjustment.

```auto
import java.util.Date
queryData = data['tag_history'].getCoreResults()
arr = []

for row in range(queryData.getRowCount()):
	oldTime = queryData.getValueAt(row, 't_stamp')
	newTime = system.date.addMinutes(oldTime, -60)
	arr.append(newTime)
data['tag_history'] = system.dataset.addColumn(queryData, arr, 'newTime', java.util.Date)

```

I think i am missing something obvious here with how `system.date.add???` works. If i add -1 hours it subtracts 1 hour but also ignores the DST change, but if use system.date.addSeconds or system.date.addMillis it does the date math but does not ignore the DST change. I could not figure it out, hopefully someone can enlighten me.

This is the result with adding -60 minutes (same results with -1 hours).  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/5/a5046738d80ed6c30bd4eb5aeceefc9de96b2e5f.png)

And with adding -1 seconds.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/324722748fbeea5fc0e0a40399f0d4bdd6d9b55f.png)

---

<div class="post-metadata">

**Author:** ![j.israelsen](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@j.israelsen](https://forum.inductiveautomation.com/u/j.israelsen)\
**Post date:** [January 10, 2023, 6:02pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/10 "2023-01-10T18:02:35Z")

</div>

I'm having this exact same issue. Is there anyway to get an aggregation mode by day (instead of hour). I would hope something like that would then handle the 23 hour day in March and the 25 hour day in November.

 ![Query_with_Aggregation](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/450b46b6e733479f9086b1c32863a242ba6a8326.png)

Or is there other work arounds people have? I would think a lot of people would have run across this issue and had to deal with it. It's surprising it isn't easier to deal with.

---

<div class="post-metadata">

**Author:** ![j.israelsen](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@j.israelsen](https://forum.inductiveautomation.com/u/j.israelsen)\
**Post date:** [March 1, 2023, 4:27pm UTC](https://forum.inductiveautomation.com/t/scheduled-reports-offset-due-to-daylight-savings/57227/11 "2023-03-01T16:27:44Z")

</div>

To whom it may concern, a proposed workaround his presented here:

[https://forum.inductiveautomation.com/t/report-tag-historian-query-aggregation-by-day/69948](https://forum.inductiveautomation.com/t/report-tag-historian-query-aggregation-by-day/69948)
