Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

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.

Number of Mondays in a given Month....

Featured Replies

Does anyone know a good way to get a total of the number that a certain day(ie. Monday) of the week occurs in a given month? In otherwords, how many mondays in the month of September 2002.

I can think of several ways to get the result, but they are neither elegant nor efficient and involve several different fields or scripts. There's bound to be a elegant calculation for this. Anyone?

The general formula for counting specific weekdays over any arbitrary period is:

Int((EndDate-StartDate)/7) +( Mod(EndDate-StartDate, 7) >= Mod(7+QueryDay-DayofWeek(StartDate), 7))

QueryDay is an integer 1..7 representing the day of week you want to count Sunday is 1, Monday is 2, Saturday is 7 etc.

StartDate and EndDate define the period over which you want to count. So, for a particular month you could calculate StartDate as:

Date(QueryMonth,1,QueryYear)

and EndDate as:

Date(QueryMonth+1,1,QueryYear)-1

where QueryMonth and QueryYear are the month and year you are interested in.

  • Author

Thanks Bob. That does the trick.

Create an account or sign in to comment

Important Information

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

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.