-
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
Mastering Salesforce Packages: Managed vs. Unmanaged
Salesforce packages simplify application development, deployment, and distribution in the Salesforce ecosystem. This blog explores Salesforce packages, their significance for administrators, developers, and users. We'll…
Apex Trigger In Salesforce - Get Started
The trigger is an apex code that executes before and after the DML operations. Following are the DML operations:- Insert Update Delete Upsert Merge Undelete…
Insert ContentVersion By Rest API | The Salesforce Developer Guide
In this document, we are going to insert a contentVersion from a Salesforce Source org to a particular sObject of target Salesforce org by using…
Popular Salesforce Videos
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…
Custom Settings and Custom Metadata Explained | 3-Minute | Salesforce Tutorial
In this video, Alex walks you through Custom Settings and Custom Metadata types in Salesforce and the difference between them. Discover how ENWAY can assist…
Creation Of Validation Rules And Verifying Them In Salesforce
Learn how to create and verify validation rules in Salesforce. This video will cover the following points - 1. Introduction Get a brief introduction about…