# Time Units in dateArithmetic

**URL:** <https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 20, 2025, 4:54pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631 "2025-06-20T16:54:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmaline](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mmaline](https://forum.inductiveautomation.com/u/mmaline)\
**Post date:** [June 20, 2025, 4:54pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/1 "2025-06-20T16:54:28Z")

</div>

I'm trying to select how to view back on a tag's history using a Time series chart with a tag history binding. I want to change the time increments using a dropdown selector. This is the expression I'm trying to use for the start date:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/c/bc8a18deab10e97c5a91b815d675813d8333ad35.png)  
The chart doesn't update when I change the unit on the dropdown.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 20, 2025, 5:22pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/2 "2025-06-20T17:22:10Z")

</div>

Hi, mmaline, and welcome to the forum. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can post a screenshot too if it provides context.

Note that Expression Language ignores multiple whitespace and line breaks (unlike Python / Jython) so you can wrap and indent the expression to make it more readable. You can also resize the window. (You've cropped the code.)

It might help spot an error if you copy the dropdown's `options` properties and paste that too, formatting in the same way.

Also, be aware of the `now()` expression function syntax.

```python
now() // retriggers at the default tag group rate (typically 1000 ms).
now(0) // is evaluated once. This could be part of your problem.
now(1234) // is evaluated every 1.234 s.

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 20, 2025, 5:45pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/3 "2025-06-20T17:45:26Z")

</div>

What makes you think `dateArithmetic` is the cause ?  
Show us more of what you're doing, so we can get a better picture.

---

<div class="post-metadata">

**Author:** ![mmaline](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mmaline](https://forum.inductiveautomation.com/u/mmaline)\
**Post date:** [June 20, 2025, 6:16pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/4 "2025-06-20T18:16:57Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/de5ade28e705d2c27f7afda9332dc24fdb0f3f8c.png)  
dateArithmetic(now(0), -1, {../Dropdown.props.value})

That is the tag history binding and the expression I'm using for the start date. When I try to input the data in this way it won't populate anything, so I'm probably doing multiple things wrong.

---

<div class="post-metadata">

**Author:** ![mmaline](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mmaline](https://forum.inductiveautomation.com/u/mmaline)\
**Post date:** [June 20, 2025, 6:20pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/5 "2025-06-20T18:20:34Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/f/cfe73eb90f39688037560f9d1901c32c8b6146ae.png)  
This is were the binding is in the component properties. I can get the data I'm looking for if I statically set the time increment to 'hour' or "hour" along with the other valid time increments.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 20, 2025, 6:23pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/6 "2025-06-20T18:23:47Z")

</div>

> [@Transistor](#):
>
> It might help spot an error if you copy the **dropdown**'s `options` properties

You've posted part of the chart's `series` property.

Post the **dropdown**'s `options` properties correctly formatted as code.

---

<div class="post-metadata">

**Author:** ![mmaline](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mmaline](https://forum.inductiveautomation.com/u/mmaline)\
**Post date:** [June 20, 2025, 6:28pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/7 "2025-06-20T18:28:13Z")

</div>

```python
[
  {
    "value": "\"hour\"",
    "label": "Hour"
  },
  {
    "value": "\"day\"",
    "label": "Day"
  }
]

```

That is what I have for the dropdown's `options` properties

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 20, 2025, 6:48pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/8 "2025-06-20T18:48:17Z")

</div>

Why the `\"` ?  
Try without them.

---

<div class="post-metadata">

**Author:** ![mmaline](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mmaline](https://forum.inductiveautomation.com/u/mmaline)\
**Post date:** [June 20, 2025, 6:54pm UTC](https://forum.inductiveautomation.com/t/time-units-in-datearithmetic/107631/9 "2025-06-20T18:54:14Z")

</div>

Thanks for your help! That's what I was doing wrong.
