The Formatduration() function converts a duration to text according to the provided format.

This function is NOT SQL compatible. For more information about SQL compatibility, see our documentation.

Returns a new text string that is the text representation of a duration. Returns Invalid expression ifnumberis unknown or the indicated format is not valid for duration.



FormatDuration('3d4h17m30s', "hh") => 04


FormatDuration('2d3h21m54.87s', currentlanguage) => 02:03:21:54.87




date time


a duration, in minutes, hours or seconds.




the format is used to specify how the duration should be represented. You can find the different formats below.




this parameter is used to specify the time representation of that language. If the language parameter contains an unknown value, the default portal language is used to format the duration.

The format parameter can contain a number of WEM specific options:

  • days - returns the total number of days in the duration

  • hours- returns the total number of hours in the duration

  • minutes - returns the total number of minutes in the duration

  • seconds - returns the total number of seconds in the duration

  • long - returns the duration as a written string, based on the portal language

  • stopwatch - returns the duration formatted as follows: (hours):(minutes):(seconds)

  • clock - returns the duration formatted as follows: (hours):(minutes)

You can also use the [Microsoft format strings]( ) to format the duration.

Last updated