Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to Count Days to The Third Wed of The Month

Featured Replies

Posted

I was asked if there was a way to have the ISY know that it was the third Wed of the month and if it could keep track of how many days away the next third Wed was. The first part was easy using the day/month/year etc programs I had written but the second part stressed my brain a little bit. I came up with a solution and thought you might like to see it (and hopefully not find any errors). I am not sure that many people will have a direct need for this, but the logic may apply to other applications. It consists of three programs, two of which are very simple and the third is a bit more complex. The concept is that it is always going to be either 4 or 5 weeks between 3rd wed of the month depending on how long of a month you are currently in and when in that month the wed falls. I wrote the program to look at what month you were in (and thus how long it is, remembering leap year), and look at what day of the month your 3rd wed is falling on, and then reset the counter to either 34 or 27 on the day after the third wed.

 

31 30 29 day month days to third wed

If
       (
            (
                 $iMonth is 1
              Or $iMonth is 3
              Or $iMonth is 5
              Or $iMonth is 7
              Or $iMonth is 8
              Or $iMonth is 10
              Or $iMonth is 12
            )
        And $iDay.of.Month <= 18
       )
    Or (
            (
                 $iMonth is 4
              Or $iMonth is 6
              Or $iMonth is 9
              Or $iMonth is 11
            )
        And $iDay.of.Month <= 17
       )
    Or (
            $iMonth is 2
        And $iLeap.Year is 0
        And $iDay.of.Month <= 16
       )

Then
       $iDays.To.Third.Wed  = 34
       $iDays.To.Third.Wed Init To 34

Else
       $iDays.To.Third.Wed  = 27
       $iDays.To.Third.Wed Init To 27


 

Days to Third Wed Countdown

If
       Time is 12:00:10AM

Then
       $iDays.To.Third.Wed -= 1
       $iDays.To.Third.Wed Init To $iDays.To.Third.Wed
       Run Program 'Test for -1' (If)

Else
  - No Actions - (To add one, press 'Action')


 

 

Test for -1

If
       $iDays.To.Third.Wed is -1

Then
       Run Program '31 30 29 day month days to 3rd wed' (If)

Else
  - No Actions - (To add one, press 'Action')


 

You'll notice there is no provision for 28 day Feb's since they will always be 28 days apart and will just automatically fall to the "else" clause.

 

Let me know what you think.

Thank you for posting this, it will be very helpful to me and others.

 

This and the others are of great work.

 

Thanks again !

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.