FormatDuration

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.

Syntax

FormatDuration(duration,format)

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

FormatDuration(duration,language)

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

Parameters

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](https://msdn.microsoft.com/en-us/library/ee372287(v=vs.110).aspx ) to format the duration.

Last updated