# How to convert hours minutes seconds

**URL:** <https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315>\
**Category:** Ignition\
**Created:** [March 11, 2018, 12:02am UTC](https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315 "2018-03-11T00:02:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 11, 2018, 12:02am UTC](https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315/1 "2018-03-11T00:02:29Z")

</div>

I have 3 int tags that I want to combine in to a memory tag. To display in this format HH:MM:SS. How would I go about doing this? expression tag? etc

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [March 11, 2018, 1:31am UTC](https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315/2 "2018-03-11T01:31:14Z")

</div>

I would use the setTime function. You could pass it now() for the initial value then pass your three integer tags to specify hour,minute, and second. I would utilize an expression tag to do this.

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 11, 2018, 1:36pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315/3 "2018-03-11T13:36:57Z")

</div>

using Dint’s not ints to show downtime in HH:MM:SS

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [March 11, 2018, 5:12pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315/4 "2018-03-11T17:12:50Z")

</div>

A simpler method may be to make a string expression tag with the following expression.

Str(HourTag) + ‘:’ + str(MinutesTag) + ‘:’ + str(SecondsTag)

You may want to introduce some if then logic to add a zero to the front if they are single digit. You could use the following check for any of the three.

If(len(str(HourTag)) == 1,’0’ + str(HourTag),str(HourTag))

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 11, 2018, 6:02pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-hours-minutes-seconds/17315/5 "2018-03-11T18:02:04Z")

</div>

I ended up doing it like this

toString({[.]DowntimeHours}) + ‘:’ + // Hour  
toString({[.]DowntimeMinutes}) + ‘:’ + // Min  
toString({[.]DowntimeSeconds}) //Sec

Is there a way to trend this data?
