# Time calculations in Better logic

**URL:** <https://community.homey.app/t/time-calculations-in-better-logic/11078>\
**Category:** Apps\
**Tags:** app\
**Created:** [March 27, 2019, 8:58am UTC](https://community.homey.app/t/time-calculations-in-better-logic/11078 "2019-03-27T08:58:45Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![viix](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viix](https://community.homey.app/u/viix)\
**Post date:** [March 28, 2019, 9:59am UTC](https://community.homey.app/t/time-calculations-in-better-logic/11078/3 "2019-03-28T09:59:05Z")

</div>

Use the $timenow$ with a MathJS card and covert the epoch time to mins.

use 2 flows with the

> execute mathJS card

with **`$timenow$`** to a betterlogic variable for **SunEvent1** & **SunEvent2**.  
Then to calculate the difference rounded to the nearest minutes

> **`round(($SunEvent2$ - $SunEvent1$)/60)`**

---

_[View the full topic](https://community.homey.app/t/time-calculations-in-better-logic/11078)._
