-
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
Benefits of Salesforce CPQ Software for Your Sales Team
Customers don't want to be burdened with details about your sales process or the intricacies of your product catalog. The automation of business operations, especially…
Salesforce Einstein: The Beacon of Business Growth
Businesses need more than just the right services and products to stand out in the market. Strategical use of data is paramount to promote quality…
5 Groundbreaking Features Exclusive to Salesforce Lightning Experience
With Salesforce stopping to make enhancements to Salesforce Classic, companies have started moving to Salesforce Lightning Experience. However, migrating from Salesforce Classic to Salesforce Lightning…
Popular Salesforce Videos
Is It Possible To Get 20 Lacs Above Package In Salesforce?
Join this useful group for Salesforce job & career info. Watch this video and join this group to clear all the doubts you have regarding…
Manual & Apex Managed Sharing in Salesforce
In this video, we will talk about Manual Sharing and Apex Managed Sharing. Manual Sharing Manual Sharing is used to share the record Manually. For…
Salesforce for Marketing
Learn how to bring marketing and engagement together. Salesforce Marketing Cloud helps you connect marketing, sales, service, and more on a single platform. Marketers get…