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
Umamageshwari PalanisamyUmamageshwari Palanisamy 

How to calculate the organization business hours ?

I need to store the organization business hours value in a field .. Is it possible to store that in a formula field ? If not , by any chance can we get the organization business hours through coding or something ? In my org , there are 33 countries and each country has different org business hours(monday - sunday)... Please help me out !! thanks in advance !!!
Mario PaesMario Paes
Salesforce provides the BusinessHours object and class, which can be used to query for using Apex.

SELECT IsActive, Id, Name, CreatedById, CreatedDate, IsDefault, FridayEndTime, FridayStartTime, LastModifiedById, LastModifiedDate, MondayEndTime, MondayStartTime, SaturdayEndTime, SaturdayStartTime, SundayEndTime, SundayStartTime, SystemModstamp, ThursdayEndTime, ThursdayStartTime, TimeZoneSidKey, TuesdayEndTime, TuesdayStartTime, WednesdayEndTime, WednesdayStartTime FROM BusinessHours
WHERE isDefault = true

There are also a few functions in the class you could use for any calculations if required.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_businesshours.htm