# Countdown Timer

**URL:** <https://forum.inductiveautomation.com/t/countdown-timer/67678>\
**Category:** Ignition\
**Created:** [December 15, 2022, 3:44pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678 "2022-12-15T15:44:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schwartzds](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/schwartzds/32/6777_2.png) [@Schwartzds](https://forum.inductiveautomation.com/u/Schwartzds)\
**Post date:** [December 15, 2022, 3:44pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/1 "2022-12-15T15:44:11Z")

</div>

Might sound crazy but looking to display a countdown or count up timer based upon a tag change. Any ideas or help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [December 15, 2022, 3:46pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/2 "2022-12-15T15:46:07Z")

</div>

If you have a start and finishing timestamp, I would think that using one of these expressions would suffice - [\*Between - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/*Between)

---

<div class="post-metadata">

**Author:** ![Schwartzds](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/schwartzds/32/6777_2.png) [@Schwartzds](https://forum.inductiveautomation.com/u/Schwartzds)\
**Post date:** [December 15, 2022, 3:50pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/3 "2022-12-15T15:50:06Z")

</div>

Thanks, any ideas on how to write the script or expression?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [December 15, 2022, 3:52pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/4 "2022-12-15T15:52:49Z")

</div>

Need a bit more information on your setup and exact end goal, not sure what you are doing but assuming you have a tag that is a date type representing the end time, you could do something like

`secondsBetween(now(100), {path.to.tag2})` would should show the number of seconds from the current moment until your expected end time stamp. This would update every 100 milliseconds based on the parameter fed to `now()`.

---

<div class="post-metadata">

**Author:** ![Schwartzds](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/schwartzds/32/6777_2.png) [@Schwartzds](https://forum.inductiveautomation.com/u/Schwartzds)\
**Post date:** [December 15, 2022, 3:56pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/5 "2022-12-15T15:56:22Z")

</div>

Just want a timer to show when our transfer switch will switch back to normal utility power. I have a tag that shows we are on regular utility power and another that shows that generator is running. Want to show a timer when regular utility power is restored. It takes 15 minutes to transfer.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 15, 2022, 4:30pm UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/6 "2022-12-15T16:30:04Z")

</div>

If you've got a tag indicating which power source you're on, add a tag change script to it that writes the current timestamp to some other tag. Then in your UI, use @bkarabinchak.psi's expression to show the delta between that stored timestamp and the current time for a 'count up'.

If you're _guaranteeing_ 15 minutes, then do the same, but 'store' time of switch + 15 minutes (`system.date.addMinutes()`) and use the same delta display logic.

---

<div class="post-metadata">

**Author:** ![Ngonidzashe\_Francis](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Ngonidzashe\_Francis](https://forum.inductiveautomation.com/u/Ngonidzashe_Francis)\
**Post date:** [August 18, 2023, 6:31am UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/7 "2023-08-18T06:31:52Z")

</div>

Hi @paul-griffith,  
I have a similar question but I need to make a countdown timer of 400s from the moment a particular tag changes. Looking for a simple timer that states: "400" then "399" ..... "0"

---

<div class="post-metadata">

**Author:** ![Ngonidzashe\_Francis](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Ngonidzashe\_Francis](https://forum.inductiveautomation.com/u/Ngonidzashe_Francis)\
**Post date:** [August 28, 2023, 1:33am UTC](https://forum.inductiveautomation.com/t/countdown-timer/67678/8 "2023-08-28T01:33:14Z")

</div>

Following both solutions above, I've been able to get this working. Thank you for that.
