# How to store and calculate number of hours or days?

**URL:** <https://community.homey.app/t/how-to-store-and-calculate-number-of-hours-or-days/139872>\
**Category:** Questions & Help\
**Tags:** advancedflow\
**Created:** [July 16, 2025, 11:51am UTC](https://community.homey.app/t/how-to-store-and-calculate-number-of-hours-or-days/139872 "2025-07-16T11:51:36Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [July 16, 2025, 4:54pm UTC](https://community.homey.app/t/how-to-store-and-calculate-number-of-hours-or-days/139872/4 "2025-07-16T16:54:58Z")

</div>

> [@Walle](#):
>
> concerned about what happens if there’s an unexpected hub shutdown (e.g., due to a temporary power cut). Do timers survive restarts?

❌ onboard delays don’t; I"d use them for small delays (seconds) only  
✅ timers from the Chronograph app do, while they count up towards a timestamp, set by the “duration” value.

The other things you mention can also be done with Chronograph timers. It has a “day” unit for instance, so no calculations with seconds or minutes needed.  
These timers can delay for 999 days, maybe even longer:

 ![Screenshot_20250716_190722_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/f/bf9e3185625d29a0190078293a6916082ac35d53.jpeg)

See it counting down:

 ![Screenshot_20250716_191023_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/8/28343cc159676c07f94277af78ed79da87d03886.jpeg)

1. 

You can count hours, or days etc. with variables as well:

When..  
every day  
Then..  
calculate numeric var “vac” as {{ [var] +1 }}

This increases the variable’s value by 1 each day.  
(at some point, reset it to 0 again)

Now you can trigger flows based on that number

When..  
variable “vac” has changed  
And..  
logic card value “vac” is exactly 3 (or 5 or 9 or 400)  
Then..  
Do things

or:

When…  
the last person left  
And..  
logic card value “vac” is exactly 3 (or 5 or 9 or 400)  
Then…  
-go vacuum  
-logic card set variable “vac” to 0

1. 

When you really want to calculate with timestamps, I’d recommend to read the [Better logic library app topic](https://community.homey.app/t/app-pro-better-logic-library-for-users/71876).

---

_[View the full topic](https://community.homey.app/t/how-to-store-and-calculate-number-of-hours-or-days/139872)._
