WeekStartingMONDAY ( xDate )
Returns the date of Monday for any date within the week.
Average rating: 4.1 (29 votes) Log in to vote
Tony Tanevski - Show more from this author
Hi-Voltage http://www.hi-voltage.com.au |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Returns the date of Monday for any date within the week.
For example, if today is Friday, what was the date at the start of this week (Monday).
Useful for reporting or calendars.
Comments
Sean, Private Feb 2, 2010 |
||
I think you almost had it but there is no reason for the let or case statement. This is simpler. GetAsDate ( field ) - DayOfWeek ( field ) +2 Or use +1 instead of +2 to get Sunday instead of Monday. Personally I call it weekStart and add +1 in the function and add another +1 in the calculation when I call the weekStart function. There really is no need to have a weekStart and a weekStartMonday. |
||
Patrick Neame, Ironbridge Jun 3, 2011 |
||
Of course you can use GetAsDate ( EndDate ) - DayOfWeek ( EndDate ) +6 To correct data entry errors if you want the end date to be on a Friday. Thus when dealing with a working week (mon - fri) the +2 function can modify the start date to correct any errors to Monday and +6 to Friday. Be aware that if the EndDate has been entered as Sunday that will flip the end date correction through to the end of the following week. |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.