Determining Holidays


When automating your home, it's often useful to know when the day is a holiday. This article describes several ways you can do this.

If the holiday is the same date each year, it's easy. Simply use a "Date" condition in an If-Then statement. In the date condition, specify the month and date of the month. For example, to know if it's New Year's Day, check the boxes for the month "January" and the date "1". This condition will only be true when the date is the first and the month is January. This is how it would appear in your schedule:

   If 
      Date is: (Dates= 1) (Months= Jan)
   Then
      ;Do whatever you want
   End If          

Here are some of the holidays:

Holiday

New Year's Day
Groundhog Day
Lincoln's Birthday
Valentine's Day
Washington's Birthday
St. Patrick's Day
Flag Day
Halloween
Veteran's Day
Christmas Day

Date

January 1
February 2
February 12
February 14
February 22
March 17
June 14
October 31
November 11
December 25

What if the date moves around each year? For example, Labor Day is the first Monday in September, and will occur on a different date each year. Here's how to handle this:

  1. Determine the range of dates it could fall on. In this case, the first Monday of a month always falls on the first through seventh day of the month.
  2. Enter a date condition with the following items selected:
    1. All seven of the allowed dates (in this example, that's 1, 2, 3, 4, 5, 6, and 7).
    2. The day of the week (Monday).
    3. The month (September).

This condition will only be true on a Monday in September where the date is the first through the seventh. Since this is the definition of Labor Day, it will be true every Labor Day, but never on any other day. This is how it would appear in your schedule:

   If 
      Date is: (Days= M) (Dates= 1,2,3,4,5,6,7) (Months= Sep)
   Then
      ;Do whatever you want
   End If          

This same method can be used for other holidays. The key is determining what dates of the month the holiday can fall on. The following table shows some holidays that move around each year:

Holiday

M. L. King Birthday
President's Day
Mother's Day
Memorial Day
Father's Day
Labor Day
Thanksgiving (Canada)
Columbus Day
Election Day
Thanksgiving (US)

When It Occurs

3rd Monday in January
3rd Monday in February
2nd Sunday in May
Last Monday in May
3rd Sunday in June
1st Monday in September
2nd Monday in October
2nd Monday in October
Tuesday after 1st Monday in Nov.
4th Thursday in November

Possible Dates

15-21
15-21
8-14
25-31
15-21
1-7
8-14
8-14
2-8
22-28

Why isn't Easter listed? Well, Easter occurs on the first Sunday after a full moon on or after March 21. It can fall anywhere from March 22 to April 25. The only way to handle this is to get a calendar for the next several years and look up the dates. Then, enter separate If-Then statements for the actual date each year. To check the year, put the current year (its last two digits) into a variable, then check the value of the variable. For example, in 1996, Easter occurs on April 7. Here's how to enter the condition:

   Var #1 (Year) = current year
   If 
      Var #1 (Year) = 96
      And Date is: (Dates= 7) (Months= April)
   Then
      ;Do whatever you want
   End If
            

There are a couple of different ways you can use these conditions in your HomeVision schedule:

bulletUse the If-Then statement any time you need to know if it's a holiday.
bulletCreate a flag named "Today's a Holiday". Create a scheduled event that runs at 12:00 AM each day. In the event, check for all the holiday's you're interested in and set or clear the "Today's a Holiday" flag accordingly. One advantage of this approach is that all your conditions are in one place. If necessary, you could have multiple flags like "Christmas", "Thanksgiving", "Not a School Day", etc.

 

Back Up Next

Last updated:
01 October 2013

Copyright © 1996-2013, all rights reserved, by:
Custom Solutions, Inc.
1705 Canterbury Drive, Indialantic, FL 32903

HomeVision® is a registered trademark of Custom Solutions, Inc.