Skip to Content

SAP C4C - How to calculate Number of Working days between two dates ?

Nov 11, 2017 at 03:20 AM


avatar image

Hi Experts,

Is there a way to calculate number of working days between two dates in SDK ?

Duration = Date 2 - Date 1 gives me the duration in days while I would like to know this duration in working days.

It seems there is no way to specify WorkingDayCalendarCode.

Your inputs are highly appreciated !

Thanks & Regards


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anders Brødsgaard Nov 13, 2017 at 02:05 PM

Not as I know it.

We had a similar requirement, but ended up creating an utility to calculate the difference in working days between the two dates. Our approach was to add one working day a the time to Date1 and then check when it was equal to Date2. Depend on how many days you expect to be between the two days, you could start by adding eg 5 days, so the code doesn't have to iterate to many times.

It's not pretty, but it works.


Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks for your reply :-) You approach was indeed interesting..But I am wondering how would you know if there is a public holiday in between ? Adding 5 days could only take away the weekends .