# Holiday Function?

X MemberPosts: 4,368
Does any one have a Holiday function to determine if the current day is a holiday and what is?

• Obvious Troll Account, Marked for Deletion Posts: 949
I guess you'd just need to have a table of dates and corresponding strings, and compare the current date to each of them in a loop. The function would return 0 if no match, and if it matched one, return the line number of the matched holiday.
• X Member Posts: 4,368
I made a simple function for the easy holidays that occur on a fixed date and I modified my Time function to keep track of how manys times every day occurrs each month since alot of holidays are like Thanksgiving where I need to count the times a certain day occurs in a month so when I get to the 4th Thursday in November I now know it's Thanksgiving. Labor day and memorial day are also like this but Easter seems to be a bit more complicately.
Easter is always celebrated on the Sunday immediately following the first full moon after the vernal (spring) equinox. It can fall anywhere between March 22 and April 25.
I need some sort of algorithm to figure this out or a way to figure out when the first full moon is after the vernal equinox (March 20, 2007, at precisely 8:07 P.M. EDT). I parse RSS weather any way which I believe gives lunar phases so if I truly wanted to I could look for this and look for the following Sunday. I never realized how complicated holidays were.

My wife always complains that the only holidays I know are Christmas, New Years and the 4th of July of course but I had to think for a second to remember what the 4th July actuall was. Now I know why, they make no logical sense!
• Junior Member Posts: 861
there is probably a site which has all the holidays ready for you in .xml format, which you can parse
• X Member Posts: 4,368
yuri wrote:
there is probably a site which has all the holidays ready for you in .xml format, which you can parse
I'll have to give that a google. A calender in xml form or maybe even an RSS calender? If I find something I'll post it.
• Junior Member Posts: 2,159
vining wrote:
Labor day and memorial day are also like this but Easter seems to be a bit more complicately.

I need some sort of algorithm to figure this out or a way to figure out when the first full moon is after the vernal equinox (March 20, 2007, at precisely 8:07 P.M. EDT).
At the bottom of the linked page is an Easter algorithm written in BASIC.

http://www.assa.org.au/edm.html

Or you can take the easy route and just use a lookup table:

List of Easter Sunday Dates 2000-2099
``` 23rd April 2000   20th April 2025   10th April 2050    7th April 2075
15th April 2001    5th April 2026    2nd April 2051   19th April 2076
31st March 2002   28th March 2027   21st April 2052   11th April 2077
20th April 2003   16th April 2028    6th April 2053    3rd April 2078
11th April 2004    1st April 2029   29th March 2054   23rd April 2079
27th March 2005   21st April 2030   18th April 2055    7th April 2080
16th April 2006   13th April 2031    2nd April 2056   30th March 2081
8th April 2007   28th March 2032   22nd April 2057   19th April 2082
23rd March 2008   17th April 2033   14th April 2058    4th April 2083
12th April 2009    9th April 2034   30th March 2059   26th March 2084
4th April 2010   25th March 2035   18th April 2060   15th April 2085
24th April 2011   13th April 2036   10th April 2061   31st March 2086
8th April 2012    5th April 2037   26th March 2062   20th April 2087
31st March 2013   25th April 2038   15th April 2063   11th April 2088
20th April 2014   10th April 2039    6th April 2064    3rd April 2089
5th April 2015    1st April 2040   29th March 2065   16th April 2090
27th March 2016   21st April 2041   11th April 2066    8th April 2091
16th April 2017    6th April 2042    3rd April 2067   30th March 2092
1st April 2018   29th March 2043   22nd April 2068   12th April 2093
21st April 2019   17th April 2044   14th April 2069    4th April 2094
12th April 2020    9th April 2045   30th March 2070   24th April 2095
4th April 2021   25th March 2046   19th April 2071   15th April 2096
17th April 2022   14th April 2047   10th April 2072   31st March 2097
9th April 2023    5th April 2048   26th March 2073   20th April 2098
31st March 2024   18th April 2049   15th April 2074   12th April 2099
```
• Junior Member Posts: 455
If you think that's complicated wait until you learn about muslim dates.

In come countries, the first day of a month is determined by whether the moon can be seen. If there's cloud, it shifts to the next day...

http://en.wikipedia.org/wiki/Islamic_calendar
• Junior Member Posts: 2,159
In come countries, the first day of a month is determined by whether the moon can be seen. If there's cloud, it shifts to the next day...
Now there's some fuzzy logic...
• X Member Posts: 4,368
The look up table for Easter is probably the simplest approch.

Original I only wanted holidays that I could make distict door chimes for; the Turkey gobble for thanksgiving, jingle sleigh bells for Christmas starting on the 20th and a Wereworlf howling for Halloween but then I figured why not display all of them when they occur under the current date and time on the main page. Then I could create a seperate look up table for personal days like birthdays and annaversaries if I choose.
• Junior Member Posts: 2,159
vining,

In an earlier thread you said you wanted to trigger door chimes off of the Panasonic Door Phones. Did you figure out a way to make that happen?
• X Member Posts: 4,368
There werea couple methods that Dave posted; one being a 2 pole door buton the 2nd being a 24v relay or something plugged into a dedicated port on the phone system so on a door button push you forward a call or something like that to that port. I was hoping the system would simply give me and idication out the SMDR port that I could parse out but Dave said that type of notification isn't supported.

In this particular job I have addtional wires at the door phone so I'm likely going to install a 2 pole relay cuz I can't find a decent 2 pole push button that matches the one that comes with the Channel Vison Door phone. On the door button push I pull in the double pole relay of which one side would go to AMX and the other side just does what the door button did. I haven't gotten around to this yet so I still working with the "Spy" motion detectors that I installed in the porch ceilings above the steps leading to the door. These trigger the cameras and the door chime but the one at the front door tend to give false alarms on occasion so I only allow it to initiate chime between 0600 - 2200 on holidays until I get a chance to do the relay thing.

If anyone has a link to decent 2 pole push buttons I would really prefer that over any thing else but if not I think a 2 pole relay would be the next best thing. Spy motion are pretty neat and only a 1" diameter flush mount detector but I don't like the occasional false trigger although I've never had an issue with the side door so maybe I should try and replace the one in front.