-
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 Customization in 2026: Expert Strategies to Build Faster and Smarter
Your reps log into Salesforce every morning and quietly lose thirty minutes before their first call. The pipeline view is cluttered with fields nobody uses. An approval that…
Choosing the Right Cloud Consulting Company: A Decision-Making Guide
Do you wish to leverage cloud technologies or want to migrate your business to the cloud? If so, you are making a great choice! Cloud…
Custom Visualforce Lookup
If you are creating a Visualforce page with a Standard controller, you can easily create Lookup field. But when using a custom controller and you…
Popular Salesforce Videos
Salesforce Security Review | Tutorial Video
If you ever wanted to publish an app, you probably know of the Salesforce security review. While dreaded by many developers, it is far from…
Salesforce Admin Certification 2020 Questions Explained with References - Part II
How to prepare and pass Salesforce Admin Certification with Practice Exam Questions 2020 practice questions and answers for the Salesforce Administration Salesforce Certified Admin Exam Questions Salesforce Administrator Certification Exam…
Salesforce Connections 2018 Keynote - Ch. 4: U.S. Bank Is A Trailblazer
Salesforce Connections 2018 Keynote – Ch. 1: Corporate Positioning Salesforce Connections 2018 Keynote – Ch. 2: Ticketmaster Is A Trailblazer Salesforce Connections 2018 Keynote –…