Calculate the Duration in seconds
Forums
Hi All,
I need to deal with a field ( numeric type) containing a number called duration with this format for example : 14100 wich mean that the duration is 101 second, another exmaple :
1333800 = 5618 second
1410100=6061 second
So which function ca help me to get the result in second ?
Thank you.
Hi Ahmed,
Hi Ahmed,
Here is the equation I came up with to do this:
@Tton(@Ctot(@replace(@Str(TIME, 8, 0), " ", "0"), "HHMMSS"))
First create a virtual numeric field to store the result, then paste the formula into the equation editor and change the TIME for the name of the field. The equation assumes that the field holding the time is numeric.
What the equation does is it first takes the numeric time field and changes it to string (@Str, 8 characters long with no decimals). It then pads it with 0 so that it is 8 characters long (@replace changes the spaces to 0). I then change the field to a time field using the @Ctot function and a mask of HHMMSS, finally I use the @Tton to take the time field and return the number of seconds.
Hopefully that makes sense.
Brian
Hi Ahmed,
Hi Ahmed,
I don't get how the calculation works:
14100 / 101 = 139.6
1333800 / 5618 = 237.4
1410100 / 6061 = 232.7
I don't see the correlation between the numer and number of seconds or is there sometype of special formatting that is used to get the seconds.