Difference Between Two Datetime Fields in Salesforce Formula Field

Sample Code:

IF (FLOOR((EndDateTime__c - StartDateTime__c)) > 0, TEXT(FLOOR((EndDateTime__c - StartDateTime__c)) ) & " Days ", "") 
& IF(FLOOR(MOD((EndDateTime__c - StartDateTime__c)* 24, 24 )) > 0, TEXT(FLOOR(MOD((EndDateTime__c - StartDateTime__c)* 24, 24 ))) & " Hours ","") 
& TEXT(ROUND(MOD((EndDateTime__c - StartDateTime__c)* 24 * 60, 60 ), 0)) & " Minutes "
& TEXT(ROUND(MOD((EndDateTime__c - StartDateTime__c)* 24 * 60*60, 60 ), 0)) & " Seconds" 

Invoke Apex Callout From Process Builder

Sample Code:

public class ContactProcessBuilderHandler {
    
    @InvocableMethod 
    public static void sendContacts(List<Contact> conList) {
        string jsonData = JSON.serialize(conList);
        sendContactsToOracle(jsonData);
    }
    
    @future(callout = true)
    public static void sendContactsToOracle(string jsonData) {
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        req.setEndpoint('https://your endpoint url');
        req.setMethod('POST');
        req.setHeader('Authorization', 'Authorization Header');
        req.setHeader('Content-Type', 'application/json');
        req.setBody(jsonData);
        req.setCompressed(true); 
		res = http.send(req);
    }
}

Accessing keys from a map in a SOQL Query

Using .KeySet() on a map, we will get a list of all the keys returned.

Map<Id, Master_Obj__c> masterMap = new Map<Id, Master_Obj__c>([SELECT Id, Name FROM Master_Obj__c]);
List<Detail_Obj__c> objDetailList = [Select Id, Name FROM Detail_Obj__c WHERE Master_Obj__c IN :masterMap.KeySet()]

How to cover pagereference method in test class

For Custom Controller


//Page reference to your VF Page
PageReference pageRef = Page.TestPage;
Test.setCurrentPage(pageRef);

//Pass necessary parameter
pageRef.getParameters().put('Id',id); 

//init controller 
CustomCtrl objCtrl = new CustomCtrl();

//Call pageRef mymethod
PageReference objPageRef = objCtrl.mymethod();

//Put system asserts
System.assertEquals (null,pageRef);

For Standard Controller

//First create record
Account acc = New Account();
acc.Name = 'Test Account';
INSERT acc;

//Page reference to your VF Page
PageReference pageRef = Page.TestPage;
Test.setCurrentPage(pageRef);

//Pass necessary parameter
pageRef.getParameters().put('Id',acc.id);   

//Pass your object to controller     
ApexPages.StandardController stc = new ApexPages.StandardController(acc);

//Call controller
CustomCtrl objCtrl = new CustomCtrl(stc);

//Call pageRef mymethod
PageReference objPageRef = objCtrl.mymethod();

//Put system asserts
System.assertEquals (null,pageRef);