# how to calculate two day‘s working days ?

Hi,There,

How  to calculate two day‘s working days ?

is there function for it?

Many thanks,

Jack

Sorry Jack,

Could you provide more info, maybe an example of what you need?
I really couldn't understand.

Cheers.

Hi Eduardo ,

IE. date1: 2019-05-19   date2: 2019-05-26  ,  total is 8 days  ;  the working days is monday to friday,  then 5 working days , but if 2019-05-21 is public holiday , then the working days is 4 .

I want to get the value 4 between above two days.

Eduardo Jauch wrote:

Sorry Jack,

Could you provide more info, maybe an example of what you need?
I really couldn't understand.

Cheers.

Hi Jack Bao,

you can make use of days of week function to check for the day(can check for sat and sun using this function) . Please check the link below.

As for the holiday you have to  implement you own logic to check and exclude it from the count.

Hope this will be helpful  :)

Hi Jack,

Answering directly: No. There is nothing built-in to make what you want.

You can investigate Forge to see if you find something already done.

But it is more probable that you will have to implement yourself some logic to do this.

First you can do a very simple algorithm that computes the difference between the two dates (DiffDays). Than you get the DayOfWeek for the first day and correct the previous number removing the 'weekends'.

You probably will have to store the holidays in an entity, than use an aggregate to count the number of holidays that fell in a work day in the interval, removing this number from the previous value.

Cheers.