# Total Up time and Down Time

**URL:** <https://forum.inductiveautomation.com/t/total-up-time-and-down-time/63043>\
**Category:** Ignition\
**Created:** [August 16, 2022, 1:13pm UTC](https://forum.inductiveautomation.com/t/total-up-time-and-down-time/63043 "2022-08-16T13:13:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lanutoshi\_Paul](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@Lanutoshi\_Paul](https://forum.inductiveautomation.com/u/Lanutoshi_Paul)\
**Post date:** [August 16, 2022, 1:13pm UTC](https://forum.inductiveautomation.com/t/total-up-time-and-down-time/63043/1 "2022-08-16T13:13:40Z")

</div>

Hello all,

I am new to Ignition so any help rendered would be greatly appreciated!

I have a boolean tag from that goes from 0 to 1 for when the machine is active, 0 would indicate that the machine is not running. I would like to calculate the total up time and down time for a period of 24 hours and then log it to the database.

This data would then need to be displayed graphically in a menu - sorting by the date to display the total up and down times for the selected date.

I am currently using an hour meter to log the up time in a table. Is there a way to store the uptime for 24 hours then start the hour meter again on another row in the table?

How would I then get these values from the table and display them?

What is the best approach you would recommend to tackle this project?

Thank you,  
Lanutoshi

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 16, 2022, 1:20pm UTC](https://forum.inductiveautomation.com/t/total-up-time-and-down-time/63043/2 "2022-08-16T13:20:15Z")

</div>

I would setup tag history on the tag(s) and then you can use `Duration On/Off` aggregates in a tag history query. Using this method you can query any interval, not just 24 hours.  
[https://docs.inductiveautomation.com/display/DOC81/system.tag.queryTagHistory](https://docs.inductiveautomation.com/display/DOC81/system.tag.queryTagHistory)

---

<div class="post-metadata">

**Author:** ![Lanutoshi\_Paul](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@Lanutoshi\_Paul](https://forum.inductiveautomation.com/u/Lanutoshi_Paul)\
**Post date:** [August 16, 2022, 1:46pm UTC](https://forum.inductiveautomation.com/t/total-up-time-and-down-time/63043/3 "2022-08-16T13:46:35Z")

</div>

Thank you for the input! I will look into this.

I don’t have much experience with scripting either, where would you suggest I start?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 16, 2022, 1:48pm UTC](https://forum.inductiveautomation.com/t/total-up-time-and-down-time/63043/4 "2022-08-16T13:48:56Z")

</div>

> **[Inductive University](https://inductiveuniversity.com)**
>
> Inductive University is a completely free online learning platform
> to help you learn Ignition by Inductive Automation®, the most powerful SCADA software in the world

I know this can be time consuming, but spend the time watching the videos and taking the challenge quizzes.  
The link above has details and an example script for tag history.
