Skip to Content

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

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


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • 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.


    Add comment
    10|10000 characters needed 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 .