-
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
Reasons To Choose Salesforce CRM for Agribusiness | Salesforce 101
Agribusinesses are increasingly turning to Salesforce CRM (Customer Relationship Management) to help them streamline their operations, connect with customers and increase profits. As the world’s…
Create Multiple Records Of Different Salesforce Objects
Here we have a demo what we achieve through the code. What you need is to follow the below steps. Also, I welcome you guys…
How to Display Images from File Tab to Salesforce App by using Aura Component?
What are Aura Components? Aura components are a type of user interface framework used in Salesforce. They are built using the Aura framework, which is…
Popular Salesforce Videos
Salesforce Mobile App Demo
The Salesforce mobile app is an enterprise-class app that provides your users with instant access to your company's CRM data from a phone or tablet.…
Salesforce Admin Tutorial For Beginners
What is Salesforce Admin? Salesforce Admin is totally a Business Leader. Who should have in-depth knowledge, how the company operates. In designing all its Departments.…
How to Transform Sales Processes with Salesforce Anywhere
Salesforce Anywhere – a real-time interface that extends the power of Salesforce – is here to give sales leaders more visibility into what’s going on…