Loading

Convert Activity CallDurationInSeconds (Decimal) to Hours:Minutes:Seconds (Time) Format

Publiceringsdatum: Apr 2, 2026
Beskrivning
This article is about how we can convert seconds into time-readable format (HH:MM:SS).

For example, there is a field on the Task object that indicates the duration of a call in seconds. This field is populated when a call is answered using Salesforce CRM Call Center. Let's say you have a call lasting 1 minute and 35 seconds; this field will be populated as 95 seconds. Now you want to convert the total seconds into time format (HH:MM:SS); this article is all about it.
Lösning

You need to create a formula text field on the Task object and use the below formula.
 
Step 1. Navigate to Setup
 Navigate to Setup.png
 

Step 2. Click on Object Manager and then Activity 
 Object Manager.PNG
 

Step 3.  Click on Fields & Relationship and New to create the field

Fields and Relationships.PNG


Step 4. Select Formula and click on the Next button
Formula Field.PNG


Step 5. Type any label in the Field Label field. The Field Name will automatically be filled in

Field Label.PNG


Step 6. Select Text as Formula Return Type and click on the Next button


Formula Return Type.PNG


Step 7. Use the formula below and click on the Check Syntax button available at the bottom left of the editor to validate the entered formula

IF
(ISBLANK( CallDurationinSeconds),NULL,
          LPAD(TEXT( FLOOR(CallDurationinSeconds /60 / 60)),2,"0") + ":" +
          LPAD(TEXT(FLOOR( (CallDurationinSeconds)/60) - FLOOR(CallDurationinSeconds /60 / 60)*60),2,"0") + ":" +
          LPAD(TEXT( FLOOR(MOD((CallDurationinSeconds)/60,1)*60)),2,"0")
)

Check Syntax.PNG

Step 8. In the Blank Field Handling section, select Treat blank fields as blanks and click on the Next buttonBlank Field Section.PNG


Step 9. Select the appropriate Profiles for the Field Level Security and click on Next button

Establish Field-Level Security.PNG


Step 10. Select the appropriate Page Layouts and click on the Save button

Page Layout.PNG

Knowledge-artikelnummer

000394751

 
Laddar
Salesforce Help | Article