Calculating Working Days using a Microflow

Hi,  I’m currently using version 9.1.1. We are building a system where tasks are made available based on their frequency (daily, weekly, monthly etc). I’m hoping for some help working out how to find the working days within a given month, without holidays or weekends. At present we can’t use the Working Day Module from the Marketplace, because it’s incompatible with our version of Mendix. I’m new to Mendix so I’ve been struggling to work out a Microflow that will do this.  Any help or guidance would be appreciated. Thanks,
5 answers

Since working days differ per country and even per region, I would look for a source that takes this into account, for example a REST service. From this REST service you can retrieve the holidays and mark them as a non-working day. What you can also do is that you mark the holidays once a year and then you are ready for that year.

As for the weekend days, you can check for each day whether it is a Weekend-day or not, you can do this with the Format Date function available in Mendix: -format-date-function-calls 


Look at the documentation here:

You could use for non UTC dates this

formatDateTime([%CurrentDateTime%], 'EEE')

Or use the formatDateTimeUTC for the UTC dates. This will give you Fri, of Friday. See also this:

So this way you can check which day of the week it is. And you can use addDays or addDaysUTC to add a day to get the next day.





First of all you would need to have some configuration/table in your application which would store all the holidays for the month/year. 

Now with holiday day available in a table, in order to determine a weekend, which is saturday or sunday, you could use the following expression

parseInteger(formatDateTime(<date attribute>, 'u'))

which will return an integer with Monday=1 and Sunday=7

Combining the two logics you could solve your problem. Hope it helps. 


I’m not sure how to go about adding a configuration table, that does sound like a good approach though. Is there a particular module I should use?


You can create a simple entity like below, along with overview and edit pages. You can fill in the holidays for that month and use this data in your microflow to determine whether that day is holiday or not.