function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Puja khetanPuja khetan 

date time difference formula

experts ,
I have two date time field values 

submitted date =date time
released date=date time
total time field is formula return type is number .

for total time i have put like below 
released date - submitted date 

now result is showing only on days .
i want result should show days ,hours ,minutes 

can some one guide if we can do ?
like result is showing 27.56 days 
i want it to be 27 days 12 hours and 86 minutes something like this
 
Best Answer chosen by Puja khetan
Alain CabonAlain Cabon
Find the Elapsed Time Between Date/Times
 
IF(
  datetime_1 - datetime_2 > 0 ,
  TEXT( FLOOR( datetime_1 - datetime_2 ) ) & " days "
  & TEXT( FLOOR( MOD( (datetime_1 - datetime_2 ) * 24, 24 ) ) ) & " hours "
  & TEXT( ROUND( MOD( (datetime_1 - datetime_2 ) * 24 * 60, 60 ), 0 ) ) & " minutes",
  ""
)

https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5 (https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5)

 

All Answers

Alain CabonAlain Cabon
Find the Elapsed Time Between Date/Times
 
IF(
  datetime_1 - datetime_2 > 0 ,
  TEXT( FLOOR( datetime_1 - datetime_2 ) ) & " days "
  & TEXT( FLOOR( MOD( (datetime_1 - datetime_2 ) * 24, 24 ) ) ) & " hours "
  & TEXT( ROUND( MOD( (datetime_1 - datetime_2 ) * 24 * 60, 60 ), 0 ) ) & " minutes",
  ""
)

https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5 (https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5)

 
This was selected as the best answer
Puja khetanPuja khetan
Thanks Alain ,Great Help .its worked perfectly .