# Comparing time difference in HH:mm:ss

**URL:** <https://forum.inductiveautomation.com/t/comparing-time-difference-in-hhss/38122>\
**Category:** Ignition\
**Created:** [August 27, 2020, 8:41am UTC](https://forum.inductiveautomation.com/t/comparing-time-difference-in-hhss/38122 "2020-08-27T08:41:06Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [August 27, 2020, 2:02pm UTC](https://forum.inductiveautomation.com/t/comparing-time-difference-in-hhss/38122/6 "2020-08-27T14:02:59Z")

</div>

> [@Convert seconds to HH MM SS](http://forum.inductiveautomation.com/t/convert-seconds-to-hh-mm-ss/8739/9):
>
> This is almost the “right” answer - slightly cleaner/better is to just use [stringFormat](https://docs.inductiveautomation.com/display/DOC79/stringFormat): stringFormat("%02d:%02d:%02d", hoursBetween({Root Container.Popup Calendar.date}, now()), minutesBetween({Root Container.Popup Calendar.date}, now()) % 60, secondsBetween({Root Container.Popup Calendar.date}, now()) % 60 ) Note that it’s worth a disclaimer that this will “break” if you overflow 24 hours. You can solve that with an additional if statement and more complex logic, but I’ll leave that for…

See this thread for discussion on how to do this in expressions or Python.

---

_[View the full topic](https://forum.inductiveautomation.com/t/comparing-time-difference-in-hhss/38122)._
