date.previous ( )

Function stats

Average user rating
57
406
9999
Support
FileMaker 7.0 +
Date posted
16 November 2016
Version
1
Recursive function
No

Author Info
 Andries Heylen

10 functions

Average Rating 4.9

author_avatar



 

Function overview

Prototype

date.previous  ( _date;   _day )


Parameters

_date  the date from which you want to calculate


_day  the previous day (0: sunday, 1: monday, ...)


Description

Tags:  date  

Calculation that allows you to calculate previous Monday, Sunday etc.

Examples

Sample input

date.previous ( Date ( 11 ; 12 ; 2016 ) ; 2 ) //give me previous Monday


Sample output

07-11-2016

 

Function code

Let ( [
_d = _day;
_date = _date
];
_date - Mod ( ( DayOfWeek ( _date ) - _d ) ; 7 )
)

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

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

    Prototype: date.previous( _date; _day )
    Function Author: Andries Heylen (http://www.fmfunctions.com/mid/57)
    Last updated: 16 November 2016
    Version: 1

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

 

Comments

Lee
18 November 2016



In your example, shouldn’t the Sample output be 11/7/2016 instead of 07-11-2016?
  General comment
Andries Heylen
18 November 2016



depends if your American or European ;)
  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)