-
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

Introduction to DemandBlue’s Salesforce Marketing Cloud Accelerators
Marketing Cloud is one of the most prominent and widely used marketing platforms on the market. However, simply implementing Marketing Cloud for your firm isn’t easy. With…

Chrome Extensions for Salesforce - A comprehensive review
Evgeny Azimzhanov works on the team at Aquiva Labs. They build customer-centric cloud apps on several platforms - especially Salesforce. Evgeny shares his experience trying…

Data Manipulation and Error Handling in Salesforce
In Salesforce, to fetch data using apex we require DML operations. Apex allows DML operations on both List<Sobject> and single sObject to update data in…
Popular Salesforce Videos
Marketing Cloud | Salesforce Send Email
There are two ways to send an email in Marketing Cloud; Guided Send Wizard & Salesforce Send Email. The benefit of the Salesforce Send Email…
Developer Preview Live - Release Readiness Live, Winter '22 | Salesforce
The Winter ’22 release is packed full of features to help developers solve key business problems fast. Join us to learn from Product Managers and…
Direct Messaging In Salesforce | Salesforce Lightning
Salesforce has addressed the main challenge retailers face is replicating the one-to-one in-store interactions with their customers, and supporting a seamless buying experience. Resolving these…