Closing this one off – there are solutions in here and thanks to all.
I thought I’d kluged this function together correctly but apparently not. I’m looking to be able to enter the 4th Monday of the month (ie today) as an example – and get true – getting false every other time – well, I’m getting false every time and I’ve tried a couple of variations.
Anyone feeling clever this morning (once it works – it is going into BigTimer which has just seen some other improvements).
var date=new Date();
if (n > 0)
var first = new Date(date.Year, date.Month, 1);
return ((date.Day – first.Day)/ 7 == n – 1) && (date.DayOfWeek == weekday);
var last = new Date(date.Year, date.Month, 1).AddMonths(1).AddDays(-1);
return ((last.Day – date.Day) / 7 == (Math.Abs(n) – 1)) && (date.DayOfWeek == weekday);
msg.payload=dayinmonth(2,3); // assuming Monday day two – week 3 (0-3) – I’ve tried variations – I get FALSE every time