Display time duration from DINT

I've got two tags from a PLC that represent a timer duration. One is the target time (the endpoint), and one is the current value of the timer. I want to display these in a view using a label for the target and a progress bar for the current time. Since the PLC handles them as DINTs (with the value being milliseconds), converting to a datetime type was weird, but I made it look correct on the label by using a transform and forcing it to UTC time zone, so 0 is actually 0, and the duration would look correct for the 24 hour time.

However, on the progress bar, I can't seem to get the valueDisplay/format property to show the time correctly. It seems no matter what I do, it keeps representing the DINT as seconds, so the time it shows is 1000x longer than it should be.

I tried doing the transform on the "max" and "value" properties of the progress bar, but I got an error because it was expecting a numerical value instead of the datetime string. I can make a custom property that's just the PLC tag / 1000 to represent seconds, but is there any way to make the text displayed on the progress bar point to the custom property instead of the predefined "value" property?

How do you actually want it to display the duration? If you want it in seconds, you can just divide it by 1000 in the props.value expression binding. If you set the props.valueDisplay.format to "duration", then you can show the duration in HH:mm:ss assuming the value you provide is in seconds (or converted to second as above)

1 Like

I want to display the duration in HH:mm:ss.SSS format, with the PLC tags being ms. I did try formatting valueDisplay.format like that, but the valueDisplay won't show the millisecond portion of it (also tried formatting as 00:00:00.000 and 00:00:00.###), and instead represents the PLC tag incorrectly.

And I did try dividing props.value by 1000, but what I did not try was also dividing props.max by 1000 so the max and value remained at the same scale. I guess I can just drop off the decimal after that and not display the ms.

Have you searched this forum for similar posts, like this one?