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
Dan_CDan_C 

Calculating Duration without weekends.

Hi,

 

Currently my organization has calculated fields that display the duration in days of a step in one of our processes based on custom fields for Step Start Date and Step End Date. I was wondering if there was a way to figure it out using only weekdays? If the process started on a Friday and ended the following Wednesday, I want it to display 3 business days as opposed to 5 total days.

 

Thanks in advance for any help,

Dan

Ispita_NavatarIspita_Navatar

In case if your requirment is just to calculate the number of Saturdays and Sundays between two dates then try the following:-

Subtract the one date from the other and divide by 7. That gives you whole weeks for which there is one each Saturday and Sunday. If the start date  is a Sunday or end Date is a Saturday but not both then add one to the previous result.

You may not be able to find out if a Date falls on a Sunday or saturday, but I think your atctivity will not start or end on weekend , hence it can work for you.

In case it is the other way round you can have a small invisible VF widget which does this for you in the backgroup and updates the respective field.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.