Skip 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.

Week of the year

Featured Replies

FM function WeekOfYear return wrong value for year 2010 for example. 1 Jan 2010 is week 53 (year 2009) not week 1 and 8 Jan 2010 is week 1 not 2.

Normally the 1st week of the year is the week when 1Jan is after Wednesday.

Or I'm wrong?

Answered here:

http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&thread.id=35344

  • Author

Answer isn't correct.

Look here http://www.onlineconversion.com/day_week_number.htm and then on FM funciton result - results are different.

Well, I don't know correct answer ...

When I put 1/1/2010 (mm/dd/yyyy) into that calculator, it says US Standard 52 and Europe/ISO standard is 53.

When I create calculation in FileMaker (FMPA 9.0v3):

WeekOfYear ( Date ( 1 ; 1 ; 2010 ) ), it displays 1

I don't particularly trust either source (FM or that online site; both can be wrong and have errors in their calculation engines) but I DO trust Comment in his understanding of dates.

There different "standards" for date/week calculation. See this one

http://en.wikipedia.org/wiki/ISO_week_date

Simple?

Edited by Guest

Answered here:

http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&thread.id=35344

Could we please have this discussion in one place only?

  • Author

That is what I'm talking about.

FM function - Week of Year - is without any meaning and is useless.

And explanation is simple - date definitions and calculations have so many variants - not only in world around but in IT also - for example MS and Apple use different computer calendar starting dates:

MS DOS - 1.Jan 1980.g., IBM -1.Jan 1900.g., MacOS X – 1.Jan 1904.g.,Windows – 1.Jan 1601.g..

This obstacle produce mess - when you import the same date from Excel into FM - not the same result for Win and OS X based FM.

And worse - instead of date you get a day number from computer calendar start - you need to make more complicated date calculation for FM files to use on different computers.

Some detailed reflection I have provided here: http://www.infovadiba.lv/2008/09/12/datubaze-nemakot-progarammet/ - blog is in Latvian but video is from English OSX.

So FM have provided "overall" WeekOfYear function saying (from FM Help): "Fractions of weeks occurring at the beginning or end of the year count as full weeks, so the WeekOfYear function returns values 1 through 54."

Don't use in calendars directly - modify before.

  • Author

Just to explain calculation for correct WeekOfYear:

Correction=If ( DayOfWeek ( 1/1/Year) = 7 or DayOfWeek ( 1/1/Year) ≥ 1 and DayOfWeek ( 1/1/Year) ≤ 3 ; 0; 1). This can be stored as global variable via FileOpen Script.

Then WeekOfDayCorrect=WeekOfDay (Date)-Correction.

For the week containing 1/1/Year must be provided another calculation or Conditional Format.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.