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.

Dates Minus weekends

Featured Replies

I wanted a calc to let a user know they had 5 business days to return a book to the library.

This is my work around.

Hope it helps someone,

Dean

Hi Dean,

If you change your Date In to:

Case(DayofWeek(Date Out) = 2,Date Out + 4,

DayofWeek(Date Out) = 3,Date Out + 6,

DayofWeek(Date Out) = 4,Date Out + 6,

DayofWeek(Date Out) = 5,Date Out + 6,

DayofWeek(Date Out) = 6,Date Out + 6)

... then you can drop the other two calcs. DayOfWeek is a function already and so is DayName! smile.gif

And you can actually even shorten it further with:

Case(DayofWeek(Date Out) = 2,Date Out + 4,

DayofWeek(Date Out) > 2 and (DayofWeek(Date Out) < 7), Date Out + 6)

Cheers,

LaRetta

Or, you could do exactly the same thing with:

(DayofWeek(Date Out) > 2) * 2 + Date Out + 4

- which will calculate in around a quarter of the time of the expression suggested in the previous post... wink.gif

  • Author

Ray,

Thank you for the calc, make life easier.

Dean

  • Author

Thank you LaRetta & Ray.

Dean

  • 7 months later...

CobaltSky said:

(DayofWeek(Date Out) > 2) * 2 + Date Out + 4

Could someone tell me what's going on here?

Here's what I'm looking to do...

Each of my suppliers has a standard lead time (stored in their file) measured in business days. So when I place an order (there is a script), I want to set the ETA for the order to the current date plus the standard lead time in business days.

FileMaker Version: Dev 7

Platform: Mac OS X Panther

You'll also need a table with public holidays as well, to be 100% accurate.

I seem to remember Bob Weaver posting something a sample file that did like this.

April for us here in Australia has been a great month for public holidays.

Easter gave us Good Friday 9 and Easter Monday 12, plus we have ANZAC Day on Monday 26. So out of the four full weeks in April only one has a full five working days.

Hi Jason,

If you are using v7 and you want:

- to deal with a variable number of days,

- to enter the total number of days to be inclusive (ie to include the start date)

- to have internal error handling if the start date entered is not a weekday

and you are happy to ignore public holidays (ie to count them as work days), then I suggest you use:

Let(

[X = (Days - 1);

Y = DayOfWeek(StartDate);

Z = StartDate + If(Mod(5 + Y; 6); 0; Int((5 + Y) / 6))];

Z + Int(X / 5) * 7 + Mod(X; 5) + If((Mod(X; 5) + DayOfWeek(Z)) > 6; 2)

)

...where 'StartDate' is a date field and 'Days' is a number field that supplies your variable lead time. wink.gif

FileMaker Version: Dev 7

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.