Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 7372 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am stuck.

I have a database that calculates the number of days between two date fields. I need to have a total that omits Saturdays and Sundays.

Any help would be gratefully appreciated.

Posted

Case( not (IsEmpty(StartDate) or IsEmpty(EndDate));

EndDate - StartDate - 2 * Div( EndDate - StartDate; 7 ) - (WeekOfYear(StartDate) <> WeekOfYear(EndDate) and DayOfWeek(StartDate) > DayOfWeek(EndDate)) * 2 )

Posted

Or, alternatively, from the free Calculations and Scripts.fp5 file:

WorkDays (calculation, number result) =

Int((EndDate - StartDate)/7) * 5 + Mod (EndDate - StartDate,7) - If(DayofWeek(EndDate) < DayofWeek(StartDate),2,0)

Posted

Thanks to you both for replying to my question. You saved me a lot of time. I ended up doing a sort of mix of both solutions. Plus i tagged in a +1 day to make the calculation inclusive of the two dates. My two variables were date_from and date_to. The result was:

Case( not (IsEmpty(date_from) or IsEmpty(date_to));

Int((date_to - date_from)/7) * 5 + Mod (date_to - date_from;7) - If(DayOfWeek(date_to) < DayOfWeek(date_from);2;0) ) + 1

Cheers

Steve

Posted

Thanks for all the helpful hints on this topic. I have started to develop a holidays database. i think it has a few flaws but it might help people get started on a similar system.

Treat it with caution however. The calculations may be a bit flaky.

Basically, there are three main databases recording staff information, annual sick sheets, and annual holiday sheets. The last two record milestones and display a visual summary of each member of staff.

Questions on a postcard to...

holidays.zip

This topic is 7372 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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