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
*/
// ===================================
/*__LITBR__WeekOfMonth ( _date ; startingDay ) custom function ( not recursive)__LITBR____LITBR__Author:__LITBR__Daniele Raybaudi __LITBR____LITBR__Parameters: __LITBR___date - any calendar date __LITBR__startingDay - any number between 1 and 7, where 1 represents Sunday __LITBR____LITBR__Data type returned: __LITBR__number __LITBR____LITBR__Description: __LITBR__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. __LITBR__*/__LITBR____LITBR__Let(__LITBR__first = Date ( Month ( _date ) ; 1 ; Year ( _date ) );__LITBR__WeekOfYear ( _date ) - WeekOfYear ( first ) + 1 - ( DayOfWeek ( _date ) = startingDay - 1 ) + ( DayOfWeek ( first ) = startingDay - 1 )__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/229__LITBR____LITBR__ Prototype: WeekOfMonth( _date; startingDay )__LITBR__ Function Author: Daniele Raybaudi (http://www.fmfunctions.com/mid/38)__LITBR__ Last updated: 09 June 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.