+ Start a Discussion

Age field avoiding weekends



I am running crazy trying to calculate age since a custom date/time field gets populated. Avoiding weekends.

I thought I founded the formula but is giving me some errors.


Anyone has a trigger that counts the hours bases on a date/time field?. Avoiding weekends.


So it will count 24 hours from Monday to Friday.

Zero hours Saturday and Sunday!


Basically once I select Status A, I populate a custom date/time field with NOW(), and then I want the Age Status to tell me how many hours the field is with that status.

If I change the status I want the field to be Zero again....Avoiding weekends


Anyone had this issue before?



We developed a solution to this in our Case Flags app. Without giving away too much of the magic, we use the Business Hours class in Apex to exclude nights and weekends.