-
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
4 New Salesforce Einstein Features – What it means for Service Cloud users
Salesforce Einstein Key Features – Salesforce’s recent announcement of Einstein Artificial Intelligence capabilities have quickly made headlines and for all the right reasons. With the…
4 Steps to Successful Salesforce Data-Integration
Data integration is a process to streamline data from various sources into a single, unified view. The ultimate goal here is to pave a path…
Manage Ideas in Your Salesforce Community With IdeasPro
Ideas are the most powerful force imaginable. And you never know when you could stumble upon one. In the previous blog post, we talked about online…
Popular Salesforce Videos
Crash Course on Apex Triggers Salesforce | Complete Guide with Real Time Scenarios
Complete guide on Apex Triggers Salesforce 0:00 Intro 0:33 Is Triggers difficult to Learn 0:50 What is Trigger? 3:03 What are Trigger events? 11:55 How…
Security in Salesforce - What Developers Must Know
Security in Salesforce 0:00 Introduction 3:00 Agenda 4:05 Data security 5:18 User Mode & System Mode 9:13 CRUD & FLS Data Model 10:45 Enforcing CRUD…
How to Establish a Many to Many Relationship in Salesforce?
You can use master-detail relationships to model many-to-many relationships between any two objects. A many-to-many relationship allows each record of one object to be linked…