How do I convert hh:mm:ss duration (hh:mm:ss) to seconds?

Last updated: June 13, 2025

Convert Duration Formats

Some third-party phone integrations only provide duration in the (hh:mm:ss) format whereas the Ambition metric builder expects duration to be the raw number of seconds to properly calculate duration values into minutes, hours, days, etc for display within Ambition.

For example, "00:01:12" needs to be 72.

The conversion can be achieved by creating a custom formula field in Salesforce and then building a metric summing this custom field in Ambition

 Salesforce Duration Formula

/* Naive conversion using Datetime arithmetic */

IF(
    NOT(ISBLANK(YOUR_DURATION_FIELD_HERE)),
    (
        DATETIMEVALUE("2020-01-01" + " " + YOUR_DURATION_FIELD_HERE) - 
        DATETIMEVALUE("2020-01-01 00:00:00")
    ) * 1440 * 60, 
    NULL
)