-
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

Easily Migrate to Lightning Knowledge from Classic Knowledge with This Strategy Guide
Your support reps can spend hours just juggling interfaces if your Service Cloud is in Lightning but Knowledge continues to be in Classic. This switching…

How can Organizations Benefit From Salesforce Sales Cloud Implementation
Businesses today, irrespective of their scope or size need a feasible platform to pull through the fierce marketplace competition, nurture the existing customers, and acquire…

What is the Future Scope of Salesforce CRM?
Nowadays the adoption of Salesforce CRM is increasing at a tremendous pace. As per reports, Salesforce dominated the worldwide CRM market with a market share…
Popular Salesforce Videos
Join My Salesforce Team at Google!
We are hiring four Salesforce Technical Architects on my team at Google. I believe these roles are on one of these most interesting Salesforce implementations…
How To: Build A Salesforce Career with This Tool!
Timecodes 0:00 - Intro & Overview 0:57 - Talent Stacker 3:00 - Career Progression 10:08 - Flow is the Future 13:36 - Learn More/Outro If…
How To Create Workflow Rules In Salesforce | Salesforce Workflow Rules
This video walks through the steps to create a Workflow Rule within the Process Automation section of Lightning Settings in Salesforce. Get answers to the…