Sam:

I remember discussing a Javascript based solution ... but I had to do a search on the forum to find my own (other) suggestion from years ago

However, after NeoBook added the

DateToNum command, it becomes quite easy to get the

Day of the Week for any given

Date ... by calibrating ...

i) either [Year], [MonthNum], [DayNum] against [Day]

ii) or picking a very old

date against its known

Day of the week
... and then comparing the

DateToNum results of a given date against that for one of the above ... divide the difference by 7 ... adjust for the remainder (modulus) ... and you can get the

Day of the week for any specified Date.

smartmedia:

Sam's suggested method is perfect for calculating number of days between short/medium date ranges ... but it might take considerable time (with NeoBook scripting) to loop through date ranges that are (say) 2 or more years (730+ days) apart.

In which case one might consider another approach ... where all "dates" are in the converted "number" format

a) beginning with

StartDate, find the first non-holiday and non-weekend date ... i.e. if

StartDate falls on a Saturday, add 2 to it ; if it falls on a Sunday add 1 to it ; else add nothing.

b) reversing from

EndDate, find the first non-holiday and non-weekend date ... i.e. if

EndDate falls on a Saturday, subtract 1 from it ; if it falls on a Sunday subtract 2 from it ; else subtract nothing.

c) calculate number of "whole weeks" and "extra days" in the difference between (a) and (b)

d) for each "national holiday" that falls on/between (a) and (b) ... and does not fall on a weekend ... add to a "count of weekday holidays"

e) Finally ...

- multiply "whole weeks" in (c) by 5

- add "extra days" in (c)

- subtract "count of weekday holidays"

... more code to be developed ... but faster execution time to get results for long date ranges.