Brian Dunning's FileMaker Custom Functions

YearMinus ( TheDate )

Subtract one year from a given date

  Average rating: 4.2 (30 votes) Log in to vote

crisix   crisix
Stefan Pusch KG
http://www.base72.com

Share on Facebook Share on Twitter

  Sample input:
YearMinus ( "28.2.2009" )
YearMinus ( 733466 )

YearMinus ( "2/29/2008" )
YearMinus ( 733101 )
  Sample output:
29.2.2008
733101

2/28/2007
732735

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

Returns a date 1 year before the given date calculating leap years, too.

E.g., February 29th, 2000 will return February 28th, 1999
February 28th, 2001 will return February 29th, 2000

Input value may be formatted as Date or Text (e.g. 2/28/2001 or 28.2.2001, depending on System Formats) or as Number (number of days from 1/1/0001)

Output format depends on formatting of the calculation field, either as Text, Date or Number.

If the input value cannot be interpreted as a valid date, an error 0 (zero) is returned.

NOTE: This function is only valid for dates between 1901 to 2099. Complete support of Gregorian dates may follow.

 

Comments

comment   comment, VR
Apr 7, 2011
Why not use a simple =

Date ( Month ( date ) ; Day ( date ) ; Year ( date ) + 1 )

This maps February 29 to March 1 in the preceding/following year, which IMHO is just as reasonable as February 28 - and it will work across the entire Filemaker era of 4,000 years.
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: