-
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
Mastering Salesforce Data Migration: A Complete Guide
Salesforce is a leading CRM platform that helps businesses manage their customer relationships efficiently. However, moving data into Salesforce can be tricky. This guide will…
Learn About Control Access to Object | Salesforce
If you want to control any type of data access then the easiest way is to assign permission on that specific object. Objects can be…
Build a Sales Process in Salesforce | Learn How!
It is the process in which we can control the Picklist values of Stage field of Opportunity Object. We can create different sales processes for…
Popular Salesforce Videos
ChartJs Implementation In Salesforce
This was my very first lightning web component I had made on my own. Thought of sharing it 🙂 This component basically shows the no.…
How To Log Cases In Salesforce (Email-to-Case) | Salesforce Tutorial
How to log cases in Salesforce (Email-to-Case). In this video, the following points will be covered - 1. Enable Email-To-Case Get a brief introduction on…
1st Year as a Salesforce Business Analyst
If you are interested in a Salesforce Career, check out Talent Stacker. This is what I used when I first started and ended up joining…