timeToSecs
Function: timeToSecs()
Converts a duration in hours, minutes and seconds into total number of seconds. The hours or minutes part of the duration can be omitted.
You can pad zeroes, for example 02:34 is allowed.
Syntax
timeToSecs(durationString,separator)
Argument | Parameter Types | Description |
---|---|---|
durationString | String | Duration in the format hh:mm:ss, mm:ss or ss. |
separator | String | Separator used between the individual parts of the duration. |
Examples
Example | Returns |
---|---|
timeToSecs("01:00:03",":") | Returns 3603. |
timeToSecs("2 03"," ") | Returns 123. |
timeToSecs("43"," ") | Returns 43. |