-
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 Data Migration Process
Best Practices for Data Migration The process of migrating data in Salesforce Project appears to be an easy task for Salesforce Developers but it’s not…
How to Automate Sales Quotes And Win More Customers For Your Business | Salesforce
Automating sales quotes is usually put on the back burner by sales reps. But will a change of this perspective influence the sales flow effectively?…
Popular Salesforce Videos
Career in Salesforce in 2022
In this video, Shrey is talking about starting your career in Salesforce. Here are the different career choices you have or different profiles that are…
How to Logging Automated Emails on Related Records
Learn how to logging automated emails on related records. We will show you how to create a process builder using the package Send Emails. This…
Explore Record Triggered Flow | Learn Salesforce Lightning Flows | Flow Builder Videos
Creating or updating a record can trigger an auto-launched flow to make additional updates to that record before it's saved to the database. A record-triggered…