| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | RE: [ECS] Dates A.J. Griglak Mon, 13 Nov 2000 20:43:15 -0500 |
I forgot this part: If the day is near the end of the month, you need to add a check to make sure it is a valid date, for example: BEGINIF Month Is May ;----------Labor Day - Last Monday in May Do Hol:Labor Day Set Last Sunday Do Hol:Labor Day Add 1 If Hol:Labor Day Is 32 Then Hol:Labor Day Subtract 7 ENDIF ; Another goofy one is Election day, which is the Tuesday after the first Monday, goes like this: BEGINIF Month Is November ;----------Election Day - Tuesday after the first Monday in Nov Do Hol:Election Set 1st Sunday Do Hol:Election Add 2 If Hol:Election Is 9 Then Hol:Election Subtract 7 ; -=A.J. -----Original Message----- From: A.J. Griglak [mailto:aj@griglak.com] Sent: Monday, November 13, 2000 8:12 PM To: ecs-list@netbloc.com Subject: RE: [ECS] Dates Joe, A couple of weeks ago, I set out to do just that. I haven't quite got it finished, but here's what I was attempting to do... First, I set up a True/False flag that would denote if the current day is a holiday so that heating schedules, etc. could be adjusted as if it was a weekend. I found a web site listing all the holidays and what day of the month they fall on. I can't remember the actual site that I used, but here is a similar one: http://mindprod.com/HolidayCalculatorNative.html I wanted ECS to figure out the days, without hardcoding the days in each year. My idea is that on every 1st of the month, ECS will calculate the holidays for that month. For example, BEGINIF Month Is January ;----------Martin Luther King - 3rd Monday in Jan Do Hol:MLK Set 3rd Sunday Then Hol:MLK Add 1 ENDIF ; Hol:MLK would be a number, which would then be set to the day of the month that the Holiday falls on. I haven't really finished it up - for example, setting of the true/false flag when a holiday is true, but it should work OK. One thing, though - Easter is pretty complicated - you'll see when you check out that web site. I was thinking of just hard coding in Easter for the next couple of years instead of trying to calculate that one. Hope this helps in some way, and if anyone has a better way to do it, I'm all ears! -=A.J. -----Original Message----- From: Joseph LaFerla [mailto:jlafe@ntnet.nt.ca] Sent: Monday, November 13, 2000 4:49 PM To: Ecs-List (E-mail) Subject: [ECS] Dates Hi all I was wondering if anyone had any ideas to assist me here. I have a flag in my ecs system that denotes a statutory holiday. I am looking for an easy way of presetting the statutory holidays for a year and then ecs would set or clear the flag as necessary. I was thinking of putting the days and dates in a file and then reading the file with ecs and doing a comparison but I am not quite sure how this can be done. Any ideas would be greatly appreciated. Thanks in advance. Joe