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.

Featured Replies

I'm looking for a calculation that determines the number of tuesdays in a year.

  • Author

Thanks, works great. However, I can I save the number of weeks as a global variable to use in another calculation.

Hello,

Number of weeks equal number of tuesdays ?

So you could set in the end of the script $$nb_weeks = $nb_tuesdays

Tom

Hey,

You get the year, so you get the last day so you could make a calculation WeekNumber(last day of the year) it would 52 or 53 you're right

Tom

A year has either 365 or 366 days. 

In the first 364 days, there will always be 52 Tuesdays. That's because 364 days are 52 periods of 7 days each, and each of those periods will contain one Tuesday, regardless of which day the year started.

Now, a year will have 53 Tuesdays if either day #365 or #366 is a Tuesday. You can test for this by checking if the year starts on a Tuesday (if it does, then day #365 is also a Tuesday), or if the year ends on a Tuesday (if it does, then either day #365 is a Tuesday, or the year is a leap year and day #366 is a Tuesday):

Let ( [
first = Date ( 1 ; 1 ; Year ) ; 
last = Date ( 12 ; 31 ; Year ) 
] ;
52 + ( DayOfWeek ( first ) = 3 or DayOfWeek ( last ) = 3 )
)

 

15 hours ago, Tom Assia said:

you could make a calculation WeekNumber(last day of the year) it would 52 or 53

Actually, that would return either 53 or 54. In any case, it wouldn't tell you anything about the number of Tuesdays in that year.

Edited by comment

You're right, but i already answer for counting Tuesdays ;)

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.