Brian Dunning's FileMaker Custom Functions

DateOffset ( startdate ; monthoffset ; dayoffset ; yearoffset )

Returns a start date, plus or minus a specified number of months, days or years.

  Average rating: 4.6 (38 votes) Log in to vote

Erik Wegweiser   Erik Wegweiser
Intelligent Database, LLC
http://www.intelligentdb.com

Share on Facebook Share on Twitter

  Sample input:
DateOffset ( tuday ; -18 ; 7 ; 0)
  Sample output:
3/29/2006 [ if tuday is 9/22/2007]

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

Returns a start date, plus or minus a specified number of months, days or years. For example, avoids the need for substituting the less accurate "365 * 1.5" (or 547 or 547.5? or 548) for an 18-month offset in date calculations. Also makes it easier to read and remember that the date is adjusted by 18 months (rather than remember what 547 days represents).

 

Comments

Michele Olson   Michele Olson, Minnesota
Jul 10, 2012
Eric,
Thanks for the CF. It worked perfectly. I needed to select records for a 12 month period starting with the month the client wanted and going backwards for 11 months. Your function was great in solving this problem. Thanks for sharing.
 
David   David, USA
Feb 1, 2015
What about March 31 plus one month? The above gives May 1 but wouldn't you want April 30?
 

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.

Under construction. Email me your wish list for improvements.