Brian Dunning's FileMaker Custom Functions

FindMonday ( input )

finds date of Monday in week of any given date

  Average rating: 4.5 (26 votes) Log in to vote

Darrin Morton   Darrin Morton
Neocode Software
http://www.neocodesoftware.com

Share on Facebook Share on Twitter

  Sample input:
FindMonday(27/07/2013)
  Sample output:
22/07/2013

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

Finds the date of the Monday in the week of any given date. Always assumes by convention that Sunday is the first day of the week. (day 1)

input - ( DayOfWeek ( input ) ) + 2

 

Comments

Daniele Raybaudi   Daniele Raybaudi, ACI
Aug 2, 2013
What about:

input - DayOfWeek ( input ) + 2
 
Darrin Morton   Darrin Morton, Victoria, BC
Aug 2, 2013
thank you daniele, you were right, your suggestion needed a minor tweak that incorporated, works great
 
Daniele Raybaudi   Daniele Raybaudi, ACI
Aug 3, 2013
It works even without the added parentheses
 
Brian Rich   Brian Rich, Hampshire, UK
Jun 23, 2014
This doesn't give a correct result if the day of the week input is a Sunday. It returns the Monday after, not the Monday before.

If you alter the function to this:
input - DayOfWeek ( input -1 ) + 1
then it gives the previous Monday when a Sunday is specified.

It may be that some people want to calculate it as Darrin specifies, but I was caught out by the Sunday date so thought it best recorded here. Thanks for a useful function though

Brian
 

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: