Date Tools (was Working Days)

At the moment this extension provide 3 methods:

countDays: returns the number of days between two dates, excluding specific day/s of the week.
countDays2: as before, but instead of setting true/false for each day of the week to exclude, this accepts a text with days to exclude.
futureDate: add days to a given date, in the process skip all the occurences of given day/s of the week. Returns an instant.

excludeDays accepts days of the week in any format, as to exlude saturdays and sundays “71” or “7,1” or “7|1”…
Since this is become a larger extension than expected, I rationalized its name from old and shortsighted “Working days” to “DateTools”, sorry for any inconvenience.

A picture is worth a thousand words:

com.gabryk.DateTools.aix (8.3 KB)

:fire: LATEST - Version 1.0

com.gabryk.DateTools.aix (8.7 KB)

Changes: just modified the description of the extension with link to this page and version number for future reference


Weldone. keep it up. all the Top Extension Developers so far started with small efforts like yours and now they are part of the Platforms hope of working magic continuously. keep up the good work and build greater works that doesn’t exist. On behalf of Power Thunkers, i say Congratulations on your First Extension


Thank you, and let me say special thanks to Hossein that helped me in my first steps!

What about excluding also from a list of dates? That way you can exclude holidays.
Also instead of 7 flags, what about a string with the weekdays to exclude? “Mo Tu We Th Fr Sa Su”?


Thanks for your suggestions: I thought about a single input with list of days to be excluded, but I preferred this method for its comprehensibility and also because it’s easier to use with external inputs, like variables set by the user: like, you show to the user a checkbox list of weekdays and ask for choosing working days, then you can easily use the state of checkboxes in the method.

Ok, I thought about that, and I decided to keep both ideas, so this will be count2:

For excludedDays It uses a simple “contains” so the attached text can be anything containing days from 1 (sunday) to 7 (saturday). You can write it as in the example, or like CSV “7,1” or like “7|1”, or “7asdasd1”. So it should be bullet proof regarding typos. I’ll release the update in a few days.

Another function available in the next update:
add days to a date skipping “excludeDays” and returns resulting date.

1 Like

I updated the first post with latest update!

Hello Mr.

This format is available? I try but not work for me.


I need please calcule difference between this two date (Date & Time )