Rounding the output time format

Hi,
I’m using IOT Link to control my windows devices. One of the things I need to see is the how long the device is used. For that purpose I use the uptime sensor provided by IOT Link. However, the outcome is in format (00:00:00:00) as Days, Hours, Minutes and Seconds.
While the sensor’s output is sufficient for other things, the format itself is not very convenient.
image

I’m looking for a way how to format the output from 00:00:00:00 to something like this:

  • if device is on for less than hour the format should be 00:00
  • if device is on over the hour the format should be 00:00:00
  • if device is on over a day the format should be 00:00:00:00

I want to create the template which would “round” the output based on the how long the device is enabled. I’m not very good with coding, can somone help?
Many thanks