-
Hours between two date time formula showing negative values in Salesforce
I have written a formula to calculate the difference between two Date/Time fields,
Please find the formula`ROUND(24*(
(5*FLOOR((DATEVALUE(First_Response__c)-DATE(1996,01,01))/7) +
MIN(5,
MOD(DATEVALUE(First_Response__c)-DATE(1996,01,01), 7) +
MIN(1, 24/24*(MOD(First_Response__c-DATETIMEVALUE('1996-01-01 12:00:00'), 1)))
))
-
(5*FLOOR((DATEVALUE(CreatedDate)-DATE(1996,01,01))/7) +
MIN(5,
MOD(DATEVALUE(CreatedDate)-DATE(1996,01,01), 7) +
MIN(1, 24/24*(MOD(CreatedDate-DATETIMEVALUE('1996-01-01 12:00:00'), 1)))
))
), 2)Here I have a case whose created date is 12/12/2016 2:16AM and Firstresponse date is 12/12/2016 10:54 AM now the case response hour formula field shows me the difference between the above as -15.37 .
I tried to calculate the difference between two date Time for 24 hours not for a business hours, I only want to exclude weekends,
The hour calculation should be from 12:00 AM today to 11:59 PM the next day.
Please advise
Log In to reply.
Popular Salesforce Blogs
Salesforce Marketing Cloud: Your One-stop Marketing Solution
The Word-class CRM solution, Salesforce does not leave any room for doubts and connects brands and customers in the best possible way. With multiple cloud…
What is Constructor in Apex Programming? | Salesforce Apex Guide
In Apex programming, a Constructor is a unique code used to set up a newly created object. It is called right after the memory for…
The Salesforce Schema Builder — What You Need To Know
Keeping the pace of change is a constant challenge for systems and IT teams running Salesforce. Luckily, the platform comes with a ton of built-in…
Popular Salesforce Videos
Salesforce Lightning: Custom Theming and Branding
As part of myLightning, Custom Theming and Branding for Lightning Experience lets you customize key styling elements, such as the global header color, brand image,…
Salesforce Admin Freelancing - $32,000 in 1 Month - Learn How You Can Do It
I made $32,000 last month, working only 20 hours per week. I want to show you how to do the exact same thing! Pricing increases…
Salesforce & Google Analytics integration
Salesforce is one of the most popular CRMs available today. Many teams use Salesforce heavily for reporting and analysis. The ability to model the data…