cancel
Showing results for 
Search instead for 
Did you mean: 

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

Suchita92
Participant
0 Kudos

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

Suchita

Accepted Solutions (0)

Answers (1)

Answers (1)

AndersBroedsgaa
Explorer

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.

/Anders

Suchita92
Participant
0 Kudos

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 .