# OPC Tag Value Seconds to HH:MM:SS via Expression Tag

**URL:** <https://forum.inductiveautomation.com/t/opc-tag-value-seconds-to-hhss-via-expression-tag/45544>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [April 13, 2021, 5:18pm UTC](https://forum.inductiveautomation.com/t/opc-tag-value-seconds-to-hhss-via-expression-tag/45544 "2021-04-13T17:18:37Z")\
**Posts on this page:** 1\
**Showing post:** 23

<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:** [April 28, 2021, 5:26pm UTC](https://forum.inductiveautomation.com/t/opc-tag-value-seconds-to-hhss-via-expression-tag/45544/23 "2021-04-28T17:26:59Z")

</div>

Not an expression, but another option would be to do this in a script library:

```auto
from java.util import Locale
from com.inductiveautomation.ignition.common import FormatUtil

def formatTime(time):
	return FormatUtil.formatDuration(Locale.getDefault(), time, FormatUtil.DurationFormatStyle.COMPACT, False)

```

```auto
>>> formatTime(1123311123)
u'13d 00:01:51'
>>> formatTime(1123311)
u'00:18:43'
>>> formatTime(38460)
u'00:00:38'
>>> formatTime(38460123)
u'10:41:00'

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/opc-tag-value-seconds-to-hhss-via-expression-tag/45544)._
