# 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:** 5

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 13, 2021, 5:26pm UTC](https://forum.inductiveautomation.com/t/opc-tag-value-seconds-to-hhss-via-expression-tag/45544/5 "2021-04-13T17:26:41Z")

</div>

Try this:

```auto
if(
	isNull({[~]Tag}),
	"0:00:00",
	stringFormat(
		"%02d:%02d:%02d",
		toInt(floor({[~]Tag}/3600)),
		toInt(floor({[~]Tag}%3600/60)),
		toInt(floor({[~]Tag}%60))
	)
)

```

If your float value is too large the first value will have more than 2 digits.

---

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