Hi John,

For this I created a table (but you could also use a list of objects) with all of the public holidays and the associated rules. Then I simply scan through the list, calculate when the public holiday is, and compare it to the date range in question.

The rules included things like "nth day of week" (eg. First Monday in June is Queen's Birthday), specific day/month adjusted for weekends (eg. 25/12, 26/12, 01/01, 02/01, 06/02, 25/04), and specific day of month adjusted to the closest of a given day of the week (eg. Auckland Anniversary - which is the closest Monday to 29 January, which isn't necessarily the last Monday in January).

Easter was the tricky one, but I found a reliable function on the internet for determining which day Easter Sunday is, then you just need to adjust for Good Friday and Easter Monday.


I hope that helps!

Regards,

Bevan


On 2/12/2014 2:22 p.m., John C wrote:

Hi all

I'd like to detect whether a certain date range includes a public holiday and if so what date and name.

I had a look on the Internet but only found something at https://pear.php.net/package/Date_Holidays which does not include NZ holidays.

Any other ideas?

(using PHP)

Thanks

John C



_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to