function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
erhimanicloud1.3965023856052195E12erhimanicloud1.3965023856052195E12 

write a code to calculate difference between two dates according to bussiness hours

hii , my requirement is to calculate hours between two dates according to my bussiness hours .
my bussiness hours is 10:00AM to 7 :00PM and  Saturday and sunday holiday .
bob_buzzardbob_buzzard
The Apex BusinessHours class provides this as standard via the diff method :

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_businesshours.htm#apex_System_BusinessHours_diff
erhimanicloud1.3965023856052195E12erhimanicloud1.3965023856052195E12
hii, 

any buddy understand this requirement ?
karthikeya 2karthikeya 2
Hi use this code

Decimal remaindays = BusinessHours.diff(Label.WCT_Default_Business_Hours_ID, Leave_Start_Date__c, Leave_End_Date__c);

its worked for me.