Need to count number of working days between dates

Hi all

I am trying to create a shortcut which counts the number of working days (not Saturday or Sunday) between two dates. The linked shortcut only counts all the days between dates.

Any help amending it would be gratefully received

https://www.icloud.com/shortcuts/b7d2929fc205448ea6e88381a65591d6

Have you read through this thread?

1 Like

That pretty good, but it requires finding a service that maps the right holidays for you. A better solution would be to look at your calendar, but there’s a lot of issues there as well.

1 Like

It depends on the definition of a business/working day. Most systems describe it based on national holidays in a region. Typically defined through a holiday maintained for the system. That’s the de facto way of doing it in the Enterprise systems I’ve worked with as then organisations can also include things like mandatory company days around holiday seasons where they might close offices for example.

A personal calendar would be preferable only for a more bespoke solution where you have a dedicated second calendar or a specific naming convention to identify the difference between what is and is not a working day and what may be some other kind of entry.

A centralised API is an easy route if one can be identified as someone else will keep the calendar maintained for you; an admin for all. But I’m not suggesting that it is a ready to go solution for all, just that it is worth a look.

Personally, I just wouldn’t use Shortcuts to directly calculate that sort of stuff. I’d probably shunt it out to something like Pythonista or Scriptable where there are more date processing libraries and functions available as well as the option to pull in regional public holiday listings either via API or say scraping a government or corporate web page. But that approach is in itself not one I’d recommend to most others … it’s getting rather complicated at that point!

Well, for example, today is a holiday in the US in that banks nd the USPS are closed as well as most government offices. However, it is otherwise a widely ignored (and disparaged) holiday, to the point that I completely forgot it was a holiday.

So, depending on what business I was in, it might not count as a business day. For my lawyer client it is not a business day because he can’t file paperwork, for example.

When I was at IBM we had the official list of holidays that IBM observed (I don’t remember if it was different that the official US list, other than where I worked wasn’t open the day after Thanksgiving.)

Growing up in Mexico each municipality (think the equivalent of a US zip code) had their own saint’s day in addition to all the other official holidays,

This might be different in other countries where the holiday list is more universal?

@Klyncher

This is the first draft of a Shortcut that gets a count of business days between two dates. It considers Saturday and Sunday the weekend, but does not take into consideration any holidays.

Count of Business Days

1 Like

You sir, are a legend. This is great. :nerd_face: