How to convert Duration 00:00:00 into "0 h 00 min"

What is the virtual column expression to convert Duration column of 00:00:00 into โ€œ0 h 00 minโ€ removing the seconds.
Thanks!

Solved Solved
0 7 915
1 ACCEPTED SOLUTION

Thanks @Suvrutt_Gurjar

The final expression I landed on was this. Always a big help.

IF(
HOUR([DURATION])=0,
CONCATENATE(MINUTE([DURATION]), " min"),

IF(
HOUR([DURATION])>0,
CONCATENATE(HOUR([DURATION]), "h โ€œ, MINUTE([DURATION]), " minโ€), โ€œโ€)

)

View solution in original post

7 REPLIES 7

@Tony_Insua
If you expand the Virtual Columnโ€™s details, you will notice the Ignore Seconds setting to turn it off.

Steve
Platinum 4
Platinum 4

Also:

@LeventK thanks. Iโ€™m looking to keep the seconds to show 00:00:00 format in the detail view only; however, in my card view, I would like to display โ€œ0h 00mโ€ this way which I believe is a separate VC expression to convert my DURATION column.

@Steve Iโ€™m having issues with the expression as I donโ€™t see it the โ€œ0h 00mโ€ example on this help guide.

Iโ€™ve tried:

TEXT([DURATION], โ€œH:Mโ€), using the [DURATION] column for when.

Result: something went wrong:
Unable to cast object of type โ€˜System.TimeSpanโ€™ to type โ€˜System.IConvertibleโ€™.

As mentioned in the article on TEXT() shared by @Steve, I believe the TEXT() works on Date , DateTime , or Time

You may need to convert the [Duration] to time value. Please try with

TEXT(TIME([Duration]), โ€œHH:MMโ€)

Another option could be

CONCATENATE(HOUR([Duration]), " h", MINUTE([Duration]), " min")

Thanks @Suvrutt_Gurjar

The final expression I landed on was this. Always a big help.

IF(
HOUR([DURATION])=0,
CONCATENATE(MINUTE([DURATION]), " min"),

IF(
HOUR([DURATION])>0,
CONCATENATE(HOUR([DURATION]), "h โ€œ, MINUTE([DURATION]), " minโ€), โ€œโ€)

)

Excellent.

Similar:

CONCATENATE(
  IFS(
    (HOUR([Duration]) > 0),
      (HOUR([Duration]) & "h ")
  ),
  (MINUTE([Duration]) & " min")
)
Top Labels in this Space