Jump to content
C4 Forums | Control4

Finding first Monday of month in Composer HE


Recommended Posts

I want to programmatically determine holidays to treat them like weekends where I turn on certain devices, like my outdoor water heater.  I believe that you can buy a Chowmain driver that tells you when it is a holiday in several countries, but I don't want to pay to do something rather simple which is to determine the summer holidays in Canada.

Let's use Labour Day as an example. It is the same in Canada as in the US and is on the first Monday in September.  Would this be the correct logic?

If month = September
	If day of the month is <= 7
    	If day of the week is = Monday
           IsHoliday= True 

I was thinking of setting up some code like this that would run just after midnight each day to set a holiday boolean variable.  You would then reset it back to false at the top of this code.

The other way of doing this is the "dumb" brute force method of hardcoding the dates for the next few years, as in

If date = 9/6/2020
	IsHoliday = True

Any other recommendations?

 

Link to comment
Share on other sites


This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.