Showing posts with label DateDifference. Show all posts
Showing posts with label DateDifference. Show all posts

Wednesday, 16 March 2016

Extension to salesforce standard formula for calculating the date difference in Minute and Seconds

Hello Awesome Salesforce Developers ,

Few days ago, I got a requirement to calculate the elapsed time between Case open date and Case closed date.

There is standard formula of salesforce which will calculate the Date Difference (Field with datatype formula and return type text)









The above formula will calculate the difference in days, hours and minutes.

My requirement is to extend this formula to calculate the difference in days, hours, minutes and seconds.

Let's calculate it !!! 

First will understand some factors about datetime.
1 Day = 24 Hours
24 Hours = 1440 Minutes
1440 Minutes = 86400 Seconds

Create a field with datatype formula and return type as Text. Use the below formula and you are set !!!!

FLOOR() -  Used to round up to nearest integer.
ROUND() - Returns the nearest number to a number you specify. 


Cheers !!!!