-
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
Schedular Class in Salesforce | Apex Developer Guide
Scheduler Class To arrange a Pinnacle course to run at standard extends, to begin with, compose a Pinnacle lesson that actualizes the Salesforce-provided interface Schedulable.…
Introduction on Salesforce and HIPAA Compliance
HIPAA stands for ‘The Health Insurance Portability and Accountability. As per HIPAA, it was established in the year 1996 that all the data related to…
Why You Need Salesforce Community Cloud? – The Final Verdict
Salesforce is the most used customer relationship management (CRM) tool around the world. However the market for a tool that is ‘CRM only’ is limited.…
Popular Salesforce Videos
See how fast and easy you can make intuitive Salesforce solutions to your users with Cauzali.
Instead of coding or very complex flows use Cauzali. Place your Cauzali model everywhere in Salesforce including in the middle of a Flow. Price between…
Integrating Salesforce Data Cloud With Other Clouds
In this extract, our speakers discussed the integration capabilities of the Salesforce Data Cloud with other clouds. Salesforce data cloud integrates with a wide range…
Embedding Salesforce Einstein Predictions in Tableau with Tomasz Bacewicz
Get the most out of Salesforce Einstein Discovery and Tableau by embedding Predictions directly in your Dashboards! Learn how from a pro. Watch this video…