How to find difference between time in Salesforce?

Sample Trigger:

trigger MemberSample on Member__c (before insert, before update) {
    for(Member__c mem : trigger.New) {
        Double var = Math.Floor((Double.valueOf(mem.End__c.getTime()) - Double.valueOf(mem.Start__c.getTime())) / (1000.0*60.0*60.0));
        mem.Description__c = String.valueOf(var);
    }
}

No comments:

Post a Comment