# Timer display on HMI

**URL:** <https://forum.inductiveautomation.com/t/timer-display-on-hmi/17486>\
**Category:** Ignition\
**Created:** [March 25, 2018, 12:19am UTC](https://forum.inductiveautomation.com/t/timer-display-on-hmi/17486 "2018-03-25T00:19:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cagibson](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@cagibson](https://forum.inductiveautomation.com/u/cagibson)\
**Post date:** [March 25, 2018, 12:19am UTC](https://forum.inductiveautomation.com/t/timer-display-on-hmi/17486/1 "2018-03-25T00:19:45Z")

</div>

I’m trying to display a 30 second stop watch/timer on the HMI. The trigger/or reset to zero would be the complete inspection button. This way production will know how fast they need to process each tube.

-Carlos

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [March 26, 2018, 7:51am UTC](https://forum.inductiveautomation.com/t/timer-display-on-hmi/17486/2 "2018-03-26T07:51:03Z")

</div>

You can use a memory tag of type “Date” to store the target time (from what time the counter should start, or to what time it should count down). You can set this via a script on a button click, or a different trigger.

Then you can create any text field and set a binding on it like below

```python
dateFormat(addSeconds(getDate(1900,1,1), secondsBetween(now(), {myTagPath/targetTime})), "HH:mm:ss")

```

What the expression does is first calculating the number of seconds between the current time `now()` and the target time. You can reverse the order depending on whether you want to count up or down.

Then the numer of seconds is added to a certain date (to create a new Date datatype), which in turn is formatted as `"HH:m:ss"`.

Every second, the `now()` is refreshed, so you see the counter updating every second.

If you just want to display the number of seconds, you can get rid of the date formatting, and the expression will be a lot simpler:

```auto
secondsBetween(now(), {myTagPath/targetTime})

```
