General Discussions
Showing Time data from tag

I have created one IO calculation tag (analog) that shows the value of PUMP RUN TIME in the second.

Ex. Let say I got a tag value as 3600 seconds.
From this tag, I need to show PUMP RUN TIME as in format 01:00:00 (hour:minute:second).

If the value is 3720 I need to show it as 01:02:00 (h:m:s)
If the value is 3750 I need to show it as 01:02:30 (h:m:s)

How can I show that?

I have created one IO calculation tag (analog) that shows the value of PUMP RUN TIME in the second. Ex. Let say I got a tag value as 3600 seconds. From this tag, I need to show PUMP RUN TIME as in format 01:00:00 (hour:minute:second). If the value is 3720 I need to show it as 01:02:00 (h:m:s) If the value is 3750 I need to show it as 01:02:30 (h:m:s) How can I show that?

I've seen this question a number of times so I've tried to put together a couple of simple options including one slightly dirty calculation that should get the job done smile

-If your elapsed time will be less than 24 hours, consider using the Time() function.
-If you can use a totalizer tag for your timer, you can use the Elapsed Time Widget
-If you are reading the elapsed number of seconds from a PLC or similar, you can check out the below formula which can be put into an expression in a text box.

{HH:mm:ss} 
Replace(Concat(
Format(2,0,Int([<TimeRunning>]/3600)), {HH}
":",
Format(2,0,(Int([<TimeRunning>]%3600/60))), {mm}
":",
Format(2,0,[<TimeRunning>]%60) {ss}
),0,8," ","0")

Where [<TimeRunning>] is a tag getting the elapsed time in seconds.

Here is a similar thing in a slightly more difficult to read but more efficient way:

{HHHH:mm:ss}
Replace(Concat(
Format(4,0,Int([<TimeRunning>]/3600) {HHHH}),
":",
Time([<TimeRunning>] % 3600, "mm:ss" {mm:ss})
),0,10," ","0")
I&#039;ve seen this question a number of times so I&#039;ve tried to put together a couple of simple options including one slightly dirty calculation that should get the job done :) -If your elapsed time will be less than 24 hours, consider using the _Time()_ function. -If you can use a totalizer tag for your timer, you can use the _Elapsed Time Widget_ -If you are reading the elapsed number of seconds from a PLC or similar, you can check out the below formula which can be put into an expression in a text box. ```` {HH:mm:ss} Replace(Concat( Format(2,0,Int([&lt;TimeRunning&gt;]/3600)), {HH} &quot;:&quot;, Format(2,0,(Int([&lt;TimeRunning&gt;]%3600/60))), {mm} &quot;:&quot;, Format(2,0,[&lt;TimeRunning&gt;]%60) {ss} ),0,8,&quot; &quot;,&quot;0&quot;) ```` Where [&lt;TimeRunning&gt;] is a tag getting the elapsed time in seconds. Here is a similar thing in a slightly more difficult to read but more efficient way: ```` {HHHH:mm:ss} Replace(Concat( Format(4,0,Int([&lt;TimeRunning&gt;]/3600) {HHHH}), &quot;:&quot;, Time([&lt;TimeRunning&gt;] % 3600, &quot;mm:ss&quot; {mm:ss}) ),0,10,&quot; &quot;,&quot;0&quot;) ````

Trihedral Engineering Ltd.

edited Apr 13 at 1:03 am
59
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft