-
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 for Logistics Industry | All You Need to Know
The logistics industry has evolved from just stock-keeping to maintaining a large amount of inventory management and handling of that inventory with Unique IDs related…
Top 5 Use Cases of Salesforce Partner Portal
Struggling to work together with external partners on projects? A Salesforce partner portal is your solution! These portals act as a central hub for your…
Engage Users and Associates in Real-time, Visual and Voice Cues With Salesforce Service Cloud
Eliminate physical contact with customers without compromising important face time. You can use Visual Remote Assistant to provide emergency assistance via video call. As a…
Popular Salesforce Videos
APIs and Integration for the Salesforce Platform
Watch this session to learn how you can integrate with the Salesforce Platform. We'll demonstrate features, APIs, and techniques for integrating with Salesforce Core, Heroku,…
Salesforce Marketing Cloud Connect Complete Setup in Lightning
Cameron Robert demonstrates a complete end-to-end setup of Marketing Cloud Connect in Lightning view. Marketing Cloud Connect creates an integration between Salesforce CRM and Salesforce…
Salesforce Confetti | Salesforce Tutorial
In this video, we show you how you can add a confetti cannon to existing paths or create them from scratch. Surprise your staff and…