WeekOfMonth ( )

Function stats

Average user rating
38
229
9999
Support
FileMaker 7.0 +
Date posted
09 June 2009
Version
1
Recursive function
No

Author Info
 Daniele Raybaudi

9 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

WeekOfMonth  ( _date;   startingDay )


Parameters

_date  


startingDay  


Description

Tags:  date  

WeekOfMonth ( _date ; startingDay ) custom function ( not recursive)

Author:
Daniele Raybaudi

Parameters:
_date - any calendar date
startingDay - any number between 1 and 7, where 1 represents Sunday

Data type returned:
number

Description:
Returns a number between 1 and 6 representing the week containing date, figured according to startingDay. startingDay indicates which day is considered the first day of the week.

Examples

Sample input

WeekOfMonth ( "06/07/2009" ; 1 )
WeekOfMonth ( "06/07/2009" ; 2 )


Sample output

2
1

 

Function code

/*
WeekOfMonth ( _date ; startingDay ) custom function ( not recursive)

Author:
Daniele Raybaudi

Parameters:
_date - any calendar date
startingDay - any number between 1 and 7, where 1 represents Sunday

Data type returned:
number

Description:
Returns a number between 1 and 6 representing the week containing date, figured according to startingDay. startingDay indicates which day is considered the first day of the week.
*/

Let(
first = Date ( Month ( _date ) ; 1 ; Year ( _date ) );
WeekOfYear ( _date ) - WeekOfYear ( first ) + 1 - ( DayOfWeek ( _date ) = startingDay - 1 ) + ( DayOfWeek ( first ) = startingDay - 1 )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/229

    Prototype: WeekOfMonth( _date; startingDay )
    Function Author: Daniele Raybaudi (http://www.fmfunctions.com/mid/38)
    Last updated: 09 June 2009
    Version: 1

*/
// ===================================

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)