# Create a live countdown

**URL:** <https://forum.inductiveautomation.com/t/create-a-live-countdown/107251>\
**Category:** Ignition\
**Tags:** ignition81, python, scripting, perspective\
**Created:** [June 10, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251 "2025-06-10T19:27:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![raees.khan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/raees.khan/32/76218_2.png) [@raees.khan](https://forum.inductiveautomation.com/u/raees.khan)\
**Post date:** [June 10, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/1 "2025-06-10T19:27:01Z")

</div>

Hello,

How to create a live count down? For example, a user will select 20 mins, I want to create a live countdown. I have no idea how to start this hence I am looking for guidance on a solution for this.

The reason I want to do this:  
I want to shelve alarms using `system.alarm.shelve()` and provide the user/operator a live countdown of the alarm for when it will be unshelved automatically

Thank You

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [June 10, 2025, 7:39pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/2 "2025-06-10T19:39:12Z")

</div>

> [@Creating a simple countdown timer](https://forum.inductiveautomation.com/t/creating-a-simple-countdown-timer/75038):
>
> Hi all. I'm currently trying to build a simple LED display count-down timer in perspective, that's formatted as HH:mm:ss. All I want it to do is reset to a specified time via a button and then proceed to infinitely countdown at an increment of 1 second till it reaches 0. It would be helpful if this could be done using the tag system so I can record the elapsed timestamp for a report later. Thank you, Cam

---

<div class="post-metadata">

**Author:** ![michaeelphillips](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@michaeelphillips](https://forum.inductiveautomation.com/u/michaeelphillips)\
**Post date:** [June 11, 2025, 4:09am UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/3 "2025-06-11T04:09:26Z")

</div>

Hi Raees,

You can create a live countdown by storing the selected duration (e.g., 20 minutes) and the start time (system.date.now()) in custom properties or tags. Then, calculate the remaining time by subtracting the current time from the end time using an expression or script. Use a Perspective Timer component to update the display every second. Bind a label or LED display to show the formatted remaining time as HH:mm: ss. When the countdown hits zero, you can trigger any follow-up action, such as ending the alarm shelf period.

---

<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 11, 2025, 7:00am UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/4 "2025-06-11T07:00:52Z")

</div>

> [@michaeelphillips](#):
>
> Use a Perspective Timer component to update the display every second.

It can be done without a timer event, using `now(1000)` in an expression will make it update every second.

---

<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 11, 2025, 7:52am UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/5 "2025-06-11T07:52:06Z")

</div>

> [@michaeelphillips](#):
>
> Use a Perspective Timer component...

Perspective doesn't have a Timer component. Did you mean something else?

---

<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:** [June 11, 2025, 10:18pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/6 "2025-06-11T22:18:28Z")

</div>

Strongly suspect the above user is a bot; would welcome evidence to the contrary.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 11, 2025, 10:32pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/7 "2025-06-11T22:32:52Z")

</div>

I was thinking that too. But some comment history looks more legit than others.

---

<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:** [June 11, 2025, 10:39pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/8 "2025-06-11T22:39:08Z")

</div>

I flagged one a little while ago for obvious spam.

---

<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 11, 2025, 10:48pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/9 "2025-06-11T22:48:52Z")

</div>

> [@paul-griffith](#):
>
> Strongly suspect the above user is a bot;

Gee, some think that I'm a bot, but even I didn't recognise it as one.  
Maybe I'm not?  
New era philosophy: "I think, therefore I (sp)am."

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 12, 2025, 12:44am UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/10 "2025-06-12T00:44:20Z")

</div>

Maybe you were programmed to think you aren't a bot? 🤭

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [June 13, 2025, 4:10pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/11 "2025-06-13T16:10:59Z")

</div>

Not sure if you found your solution or not, but here is one I did awhile back when I was testing something similar to this.

I put this in my Gateway Script

```python
tagPath = '[Temp]Countdown'
currentValue = system.tag.readBlocking('[Temp]Countdown')[0].value

if currentValue > 0:
	system.tag.writeBlocking([tagPath], [currentValue - 1])

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/0/60de03933e062e03871abdf75855ec9bd7c72c38.png)

Then made a Memory Tag with the data type set to Integer. Hope this helps.

---

<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 13, 2025, 4:24pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/12 "2025-06-13T16:24:35Z")

</div>

I'd make 2 tags:

1. a datetime memory tag with the target (the `0`)
2. an integer derived (or expression ?) tag that would use `now(1000)` and `dateDiff` to calculate the number of seconds between now and the target. You can always reprocess that integer to show hours, minutes and whatnot for display purposes

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 14, 2025, 10:56pm UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/13 "2025-06-14T22:56:35Z")

</div>

You should definitely use tags for this as @pascal.fragnoud mentions, not a timer event script. Tags are far simpler to configure and add to, but more importantly, are more efficient and performant as well

---

<div class="post-metadata">

**Author:** ![lane.duncan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lane.duncan/32/83700_2.png) [@lane.duncan](https://forum.inductiveautomation.com/u/lane.duncan)\
**Post date:** [June 16, 2025, 8:11am UTC](https://forum.inductiveautomation.com/t/create-a-live-countdown/107251/14 "2025-06-16T08:11:44Z")

</div>

Tags if you want the same value for all users, session.custom.props if you want unique values for each user.

For a very simple countdown display I will use [System]Gateway/UptimeSeconds to calculate a target value (target = uptimeSeconds + waitTime), then bind use an expression binding (remain = target - uptimeSeconds) to display the remaining time.

If the value is less than zero I will either display zero or hide the label.
