Welcome! Log In Create A New Profile

Advanced

[WD24] BankHolidayAdd() function has odd syntax

Posted by Al 
Al
[WD24] BankHolidayAdd() function has odd syntax
January 26, 2020 06:56PM
Hello All

The BankHolidayAdd() function has quite odd syntax.

For a date that occurs every year on a specific month day (not a date) the help has the following example

A date in the following format: <Month>_<Week Number>_<Day Number in the Week>. For example: 11_2_3 for the 2nd Wednesday of November.

What is doesn't say is that the month value has to have a leading zero for a month less than 10 but the day number needs no padding and must be trimmed with nospace()
The following code works for me using a file called Holidays
BankHolidayAdd(NumToString(Holidays.MonthNum,"02d") +"_"+NumToString(Holidays.WeekNum,"1d") + "_"+ NoSpace(NumToString(Holidays.DayNum,"2d")))

Regards
Al
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: