LastDayOfWeek ( )

Function stats

Average user rating
532
399
9999
Support
FileMaker 7.0 +
Date posted
29 July 2016
Last updated
29 July 2016
Version
Recursive function
No

Author Info
 David Moyer

6 functions

Average Rating None

author_avatar



 

Function overview

Prototype

LastDayOfWeek  ( aDate )


Parameters

aDate  any valid date


Description

Tags:  date   calender  

This function, given a date, will return the date of the following Saturday (or Saturday, if it's Saturday).

That is, it will group any date into a seven-day "quanta" which is designated by the last day of the week (Saturday).

This will allow you to group events by week.

This is for the Sunday - Saturday week.
For the Monday - Sunday week, edit the last line:

DayOfWeek ( GetAsDate ( aDate ) - 1 )

Examples

Sample input

LastDayOfWeek ( Date ( 7; 28; 2016 ) ) // a Thursday


Sample output

7/30/2016

 

Function code

GetAsDate ( aDate ) +
7 -
DayOfWeek ( GetAsDate ( aDate ) )

// www.davidmoyer.net

// ===================================
/*

    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/399

    Prototype: LastDayOfWeek( aDate )
    Function Author: David Moyer (http://www.fmfunctions.com/mid/532)
    Last updated: 29 July 2016
    Version: 1.1

*/
// ===================================

 

Comments

Fabrice
30 July 2016



Hi,
well, I think this function should be named SaturdayOfTheWeek, because…
http://i.imgur.com/eHtAIwP.png (map of first days of the week)
(and it's even not true for China who should be yellow as well as pretty much all african countries)
(Edited by Fabrice on 30/07/16 )
  General comment
David Moyer
30 July 2016



This is for the Sunday - Saturday week.
For the Monday - Sunday week, edit the last line:

DayOfWeek ( GetAsDate ( aDate ) - 1 )

You can adjust the function for wherever you live. If " - 1" doesn't work, try another offset.

thanks
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)