Skip to main content
Solved

Returning dates excluding non working days

  • July 13, 2020
  • 2 replies
  • 36 views

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!

Best answer by jdh

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.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • Best Answer
  • July 13, 2020

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.

  • Author
  • 1 reply
  • July 14, 2020

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!