Formatting label to display a plc tag as time


I’m trying to format an INT4 tag from my plc onto a label as a time format. for example

Tag1= 112434
Label display= 11:24:34

I’ve tried the standard numberformat expression
which gives me the following

I have also tried binding a formatted text field input to my tag but it displays nothing.

any ideas?

I would bind the int value to a custom property and then set the text when the property changes.

The code below should get you started with converting the integer value to the correctly formatted string. It handles integers less than 100,000 or >= 100,000

i = 112434 s = str(i) print "%s:%s:%s" % (s[0:len(s)-4], s[len(s)-4:len(s)-2], s[len(s)-2:len(s)])

thanks for the help. I couldn’t get your method to work. but I found another way. I ran a gateway script which I listed below and wrote the time to a string tag and displayed that in the formatted text field box. works like a charm. Today = Time =,"HH:mm:ss") system.tag.write("Company/SAP/CIP_Wash_String",Time)