Brian Dunning's FileMaker Custom Functions

WeekRange ( _weekOfYear ; _year )

Given a week number and a year it returns the range of week's days.

  Average rating: 4.3 (28 votes) Log in to vote

Daniele Raybaudi   Daniele Raybaudi - Show more from this author
ACI
http://www.aci.it

Share on Facebook Share on Twitter

  Sample input:
WeekRange ( 1 ; 2012 )
WeekRange ( 2 ; 2012 )
WeekRange ( 53 ; 2012 )
WeekRange ( 54 ; 2012 )
  Sample output:
01/01/2012
02/01/2012 - 08/01/2012
24/12/2012 - 30/12/2012
31/12/2012

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Given a week number and a year it returns the range of week's days.

Not recursive and useful mostly for countries different from USA.

The result is correct for Monday as the starting day of the week.

 

Comments

Louis Voellmy   Louis Voellmy, Zürich
Jul 1, 2013
Thx, just needed something like that!

But the result is not always correct for Monday, as you write: WeekRange ( 1 ; 2014 ) returns 01/01/2014 - 05/01/2014 but the 01/01/2014 is a Wednesday.

Grazie auguri Louis
 
Raybaudi   Raybaudi, Rome
Jul 2, 2013
The american week start on sunday, but in Italy it start on Monday.

The Custom function returns ( complete ) weeks starting at Monday, but the first day of a month can be whichever day of month.
 
Roch Drouin   Roch Drouin, Montréal
Jan 4, 2017
Hello,

Does'nt seem to work anymore with WeekRange ( 1; 2012) nor WeekRange ( 1; 2017 ) .

I use instead :

/*
WeekRange ( _date )
*/

Let (
[
// Weeks start on Sunday
dw = DayOfWeek ( _date );
startDate = _date - (dw - 1 );
endDate = startDate + 6
] ;

GetAsText ( startDate ) & " - " & GetAsText ( endDate )
)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: