How to round hoursBetween to have no decimal places.

0
Hello,  I have a need to identify the number of minutes that pass between two different date\times.   toString(hoursBetween(($currentObject/Expiration), [%CurrentDateTime%])) I have to have the  (toString) here because it is being returned as a decimal and requires a string.        This screenshot below is how the value is represented on my page, and I would like it to not have a decimal and round the value.  Any ideas to solve this problem would be great. I am displaying the value in a group box. 
asked
2 answers
0

This will truncate the decimals:

toString(floor(hoursBetween(($currentObject/Expiration), [%CurrentDateTime%])))

or if you want to round to the closest integer, first add 0.5:

toString(floor(hoursBetween(($currentObject/Expiration), [%CurrentDateTime%])+0.5))

 

answered
0

In addition to the approaches Tim suggested, you could used the following:

toString(round(hoursBetween(($currentObject/Expiration), [%CurrentDateTime%])))

this will return an integer formatted as a string

if you want a certain number of decimal places, you can use this syntax

toString(round(hoursBetween(($currentObject/Expiration), [%CurrentDateTime%]),1)

this expression will return a number with one decimal place formatted as a string

answered