How Do I Convert hh:mm:ss Durations to Seconds for Duration Metrics?
Last updated: November 23, 2026
Duration metrics in Ambition need their totals sent in seconds, such as 72 instead of 00:01:12. If your system stores durations as hh:mm:ss, add a number field that holds the same duration in seconds, then build your metric from that field.
Required permissions:
Permission to create custom fields is required in Salesforce or the system that holds the duration.
The Integrations: Edit permission is required to build the metric in Ambition.
Salesforce: Create the Formula Field
In Salesforce, add a Number formula field to the Object that holds the duration.
Paste this formula, replacing YOUR_DURATION_FIELD_HERE with your field's API name:
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)
Other Integration: Convert the Duration
Multiply the hours by 3,600 and the minutes by 60, and then add the seconds. For example, 00:01:12 will become 72.
If your data comes from a connected app, such as HubSpot, add a number field in that app that holds this calculation.
If you send data through an API or FTP Integration, convert the duration before you send it. Then select Number from that column's Field Type drop-down menu.
Build the Metric
Create a metric that sums the new number field.
Select Duration from the Display As drop-down menu.