# Easy Chart Dates via Button

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-dates-via-button/90907>\
**Category:** Ignition\
**Tags:** scripting, vision, ignition81\
**Created:** [May 24, 2024, 9:27pm UTC](https://forum.inductiveautomation.com/t/easy-chart-dates-via-button/90907 "2024-05-24T21:27:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 24, 2024, 9:27pm UTC](https://forum.inductiveautomation.com/t/easy-chart-dates-via-button/90907/1 "2024-05-24T21:27:36Z")

</div>

I don't know why this isn't working. I want a button to automatically set the historical chart to the last X hours (X) being a custom property on the button, bound to a dropdown's selected value.

```python
now = system.date.now()
old = system.date.addHours(now, (-1) * event.source.hours)

event.source.parent.startTime = old
event.source.parent.endTime = now

```

Start Date on the chart is bound to startTime and End Date is bound to endTime.

Why am I getting 1969 dates - and they're equal?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 24, 2024, 9:50pm UTC](https://forum.inductiveautomation.com/t/easy-chart-dates-via-button/90907/2 "2024-05-24T21:50:40Z")

</div>

So this is working on one gateway at not another... interesting.

I copied the XML for the window to another gateway designer on my local machine and it works...

Only difference is Win 10 and Win 11

Running `system.date.now()` on the first gateway in the script console returns the correct date.

Re-opening the window has fixed the issue.
