NbrOfWeeksInYear ( specifiedYear )
Calculate the total number of weeks in the specified year.
Be the first to rate this function Log in to vote
Marcus Nilsson - Show more from this author
Square Moon https://www.squaremoon.se/ |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
/**
* ==================================================================
* NbrOfWeeksInYear ( specifiedYear )
*
* PARAMETERS:
* $specifiedYear = (num) Numerical value
* RETURNS:
* (num) Number of weeks in the specified year
* EXAMPLES:
* NbrOfWeeksInYear ( 2013 ) = 52
* NbrOfWeeksInYear ( 2015 ) = 53
* DEPENDENCIES:
* None
* AUTHOR:
* Marcus Nilsson, Square Moon Industries AB, marcus@squaremoon.se
* PURPOSE:
* Calculate the total number of weeks in the specified year.
* NOTES:
* Developed in accordance with the ISO 8601 standard (3rd Edition, published on 3 December 2004).
* LINKS:
* https://www.briandunning.com/cf/2215
* REVISIONS:
* 2013-09-16, Marcus Nilsson. Initial release
* 2013-09-17, Marcus Nilsson. Added support for leap years.
* 2013-09-18, Marcus Nilsson. Trimmed the function significally.
* ==================================================================
*
*/
Let (
[
~dec31 = Date ( 12 ; 31 ; specifiedYear );
~dec30 = Date ( 12 ; 30 ; specifiedYear );
~dec29 = Date ( 12 ; 29 ; specifiedYear );
~dec28 = Date ( 12 ; 28 ; specifiedYear )
];
Max ( WeekOfYearFiscal ( ~dec31 ; 2 ) ; WeekOfYearFiscal ( ~dec30 ; 2 ) ; WeekOfYearFiscal ( ~dec29 ; 2 ) ; WeekOfYearFiscal ( ~dec28 ; 2 ) )
)
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.