Skip to main content

Hi,

 

I would like a formula that count  business hours between two dates in a report.. And it has to consider holidays.

 

How can i do this?

1 件の回答
  1. 2023年10月30日 19:16

    If you have Business Hours set up in the org, you can access this information from Apex. There's a method called diff() on the BusinessHours class that can be used to calculate the difference in milliseconds between a start and end Datetime. Then you would convert the milliseconds to hours. You could store this on a field in Salesforce, and then you can use that field in your report.

     

    Here's a reference to the BusinessHours apex class and its available methods: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_businesshours.htm

0/9000