Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calculate weekly dates avoid holidays

Featured Replies

Hi Guys, need some help please. Ive been searching on Briandunnings and fmfunctions website and I can't find anything I can use easily.

I have the following inputs:

No_of_Weeks = 5

StartDate = 11/5/2012

Week_Holidays [

11/12/2012

11/19/2012

]

I want to calculate and end date based adding 5 weeks to the start date. The problem is if there are any holidays within 5 week range, I need it to add a further week(s).

Any help would be appreciated. Not really looked at recursive custom functions before

I want to calculate and end date based adding 5 weeks to the start date. The problem is if there are any holidays within 5 week range, I need it to add a further week(s).

Let us be very clear here: if there is any number of holidays within the 5 weeks following StartDate, you want to add 6 weeks to StartDate? What if there are any holidays in the 6th week itself?

Also, where is the holidays list coming from?

  • Author

Hi Comment, thanks for replying. Sorry, the way I phrased the question was vague. For everyone week of holiday, I want the number of weeks to extend by 1 (so the final end date increases to take account for the holidays).

You've the nail right on the head, in my example above, I have two (they are weekly) holidays that are within the 11/5/2012...12/10/2012 (5 weeks), so I want it it to add another two weeks ultimately making my end date become 12/24/2012. However if the 12/24/2012 is a holiday and the week beyond that is a holiday, I want the end date to be a date which isn't a holiday.

The holiday list is coming from a portal, i'm using the list() to gather the details.

The more I think about it, I think I may try and script it and use a script trigger as my head is buzzing thinking about CF....

IIUC, you need to have two loops here: the outer loop takes a week at a time, and counts until it reaches 5 "clean" weeks. The inner loop goes over the days of the currently processed week and checks them against the list of holidays. If you're scripting this, you could use a relationship here to fetch the holidays falling in the currently processed week - otherwise you need a list of all holidays later than StartDate.

It's not that complicated, but it is a lot of work.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.