Solved

Returning dates excluding non working days


I have some start and end dates for activities. The start dates need to be created in FME using the previous activities end date plus one day, however if this date falls on a weekend I need to tell it to return the next working day. It would be even better if I could also exclude bank holidays along with the weekends.

 

Any thoughts or ideas on how to do this would be greatly appreciated!

icon

Best answer by jdh 13 July 2020, 20:43

View original

2 replies

Badge +22

If I was doing just the first half, I would use a conditional value in an attributeCreator.

ie, add 3 days to friday, 2 to saturday and 1 for every other day. %w returns a value from 0 -6 with 0 being sunday.

 

 

For bank holidays and the like, I would look into an API. Something like https://holidayapi.com/ if you want a commercial solution, or there are free country based apis like https://canada-holidays.ca/api.

 

 

The alternative would be to have a file/database with all the holidays that you would have to maintain.

If I was doing just the first half, I would use a conditional value in an attributeCreator.

ie, add 3 days to friday, 2 to saturday and 1 for every other day. %w returns a value from 0 -6 with 0 being sunday.

 

 

For bank holidays and the like, I would look into an API. Something like https://holidayapi.com/ if you want a commercial solution, or there are free country based apis like https://canada-holidays.ca/api.

 

 

The alternative would be to have a file/database with all the holidays that you would have to maintain.

Thanks that works great!

Reply