You may find yourself in a situation where you need to know the Monday of a particular week or any day for that matter. Here is a simple calculation that will do just that very thing for you. The idea is to find the Sunday of a week. This is because FileMaker considers Sunday the first day of the week. After you have found Sunday, you can add to the calculation the appropriate number of days to reach the desired day of the week. We want Monday, so the last thing we will be doing is adding a 1 to the end of the calculation.
First we need to find out how many days until last Sunday. The DayOf Week function returns a number from 1 to 7 for each day of the week. So if we subtract our day number from itself, we get zero, correct? Our end goal is to be one about that. So ...
Date To Use - (DayofWeek(Date To Use) - 1) is where we take our day number minus 1 ... and subtract that number from today ... to get Sunday.
Date To Use - (DayofWeek(Date To Use) - 1) + 1 adding a 1 to the end of the calculation gives us ... Monday.
An example file can be downloaded at ...
Here are some links to other posts that might be of interest in regards to this topic...
Introducing Date Functions
The Date Function
The DayOfWeek Function
The Month Function
The Year Function
More info about the author and FileMaker in general, contact me at email@example.com.
© 2008 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.
====================== ADVERTISEMENT ==============================
For more information on the InBizness SOHO and other quality FileMaker framework solutions, please visit http://www.dwaynewright.com/solutions.html