Format a duration into a human readable string.

ParameterTypeRequiredDefault ValueDescription
asstringoptional[a]  The output name of the field to set (defaults to the same as the input field).
field[b]stringrequired  The name of the input field. Must be an integer.
fromlongoptional[a]ms Magnitude of the input field.
   Valid Values
   dDays
   hHours
   mMinutes
   msMilliseconds
   nsNanoseconds
   sSeconds
   usMicroseconds
precisionnumberoptional[a]0 Number of units to use in the output.

[a] Optional parameters use their default value unless explicitly set.

[b] The parameter name field can be omitted.

Hide omitted argument names for this function

Show omitted argument names for this function

Formats a duration into a string. For example, an input event with the field duration with the value 23452553 with a default intepretation of the source value as milliseconds results in the field duration having the value 6h30m52s553ms.

logscale
formatDuration(duration)

Important

The value of the field being formatted should be an integer. If you have a floating point input value, the value will not be converted. To fix, use round() or format() to create an integer value.

Formats a duration into a string with limited precision. An input event with the field duration with the value 23452553 results in the field duration having the value 6h30m52s.

logscale
formatDuration(duration, precision=3)