Duration()

Format

Duration(Arg1 [,FormatString])

Returns

Converts the supplied argument into a Duration data type. Duration is expressed in seconds.

Inputs

Arg1: The argument to be converted into a duration.
Behaviour: Required
Dimension: Collection, SingleValue, MultiCollection
Valid data types: Decimal, Integer, String, Duration

FormatString: The string specifying the format of the first argument, if it is a string. Applies only if the first argument is a string. 
Behaviour: Optional
Dimensions: SingleValue
Valid data types: String

How to format data types

Format Codes

The following codes within the FormatString are replaced with the relevant information. The codes are not case sensitive.

  • The codes must be in quotation marks. E.g. "Day"
  • You may concatenate the codes to produce the desired string. E.g. "DayMonth"
  • You may include other text, spaces, and punctuation within the quotation marks. E.g. "Day, Month"
  • Any other text within the quotation marks is converted to upper case.
DDD Day of year (001 to 366)
DAY Full weekday name
DY Abbreviated weekday name, e.g. FRI
MONTH Full month name
MON Abbreviated month name, e.g. AUG
HH Hour in 12 hour format (1 - 12)
YYYY Four-digit year
A.M. AM or PM indicator
AM AM or PM indicator
P.M. AM or PM indicator
PM AM or PM indicator
WW Week of year, if Sunday is the first day of the week
IW Week of year, if Monday is the first day of the week
DD Day of month (01 to 31)
MM Month (01 to 12)
MI Minutes (00 to 59)
SS Seconds (00 to 59)
D Day of week
IY Two-digit year (00 to 99)
YY Two-digit year (00 to 99)

The following additional custom codes also apply:

D Day of month (01 to 31)
hh Hour in 12 hour format (1 - 12)
mm Minutes (00 to 59)
ss Seconds (00 to 59)

Examples

Expression: Duration(12)
Result: Returns the integer value of 12 as a duration of 12 seconds.
E.g. 00:00:12.000

Expression: Duration(12.2)
Result: Returns the decimal value of 12.2 as a duration of 12 seconds and 200 milliseconds.
E.g. 00:00:12.200

Expression: Duration("01:02:03", "HH:MI:SS")
Result: Returns the string "01:02:03" as a duration of 1 hour 2 minutes and 3 seconds.
E.g. 01:02:03

Expression: Duration({du'01:00'}, "HH:MI:SS")
Result: Format the supplied duration in the specified format.
E.g. 01:00:00

Release History

  • Duration() 4.6.5
    • Changed Arg1 parameter to support MultiCollection values.
  • Duration() 4.0
    • Initial version

Comments are closed