Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

HolidayNameByDate ( myDate )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.3  (35 votes)
  Discuss this Custom Function

Jonathan Mickelson, Thought Development Corp.
http://thought-dev.com

Returns the Holiday Name matching a Date, i.e. for a calendar. A dynamic holiday list is built within for stand-alone operation.

Sample Input:
HolidayNameByDate ( getAsDate ( "1/1/2004" ) )
HolidayNameByDate ( getAsDate ( "12/25/2010" ) )
HolidayNameByDate ( getAsDate ( "2/25/2010" ) )
Sample Output:
"New Year's Day"
"Christmas"
(blank result)


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

UPDATED: 4/6/2010
CHANGE: Added "= " literal text in front of the "exists" variable's patterncount test to correct for matching of partial dates in list, which incorrectly flagged 2/25/2010 as "Christmas", in addition to the correct 12/25/2010. Thanks to Bill Doerrfeld, for pointing out this logic problem!

WARNING COMPLEX CALCULATIONS WITHIN!

This function returns the corresponding US (can be modified for other countries) Holiday Name for the supplied Date. The list of Holidays can be found/modified/expanded in the Variable Declarations within the calculation.

The Holiday List used internally is identical to the list generated by the another separate custom fucntion which can also be used to display this list, called "HolidayListByYear ( yearNumber )" and could be substituted for the holidayList variable within the calc, if one wanted to make it dependant upon an external Custom Function. The Author opted for a stand-alone approach.

The result is null ("") if there is no match, so that it can be used as an autoenter in a calendar solution or other type of value lookup.

NOTE: This function REQUIRES the use of another custom function called: "DateByDayOccur" which performs date calculations for dates which occur on certain occurances of a day within a month, as in the example of Thanksgiving which falls on the "Fourth Thursday of November".

Output: Text - Holiday Name

Parameters: myDate - Any valid Date

Special thanks: To Dan Kaplan, of abledesign.com for distilling
many holiday/calendaring sources on the net.

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

The following line:

exists = PatternCount ( holidayList ; searchCrit ) ;

leads to failure as 12/25/2010 and 2/25/2010 both contain the "2/25" pattern. Accordingly, you'll get Xmas day on Feb. 25th. Xmas twice a year, nice!

Bill Doerrfeld, Seattle
April 05, 2010 10:52pm

Good catch Bill, we'd been looking into this recently as we got a couple of false hits like Thanksgiving in January! I'll be looking into updating the calc soon!

If anyone beats me to it post as a comment and I'll make the update!

best,
JM

Jonathan Mickelson, Los Angeles
April 06, 2010 3:29pm

The change has been made and updated on the site, thanks again Bill, for pointing this out!

The line:

exists = PatternCount ( holidayList ; searchCrit ) ;

Was changed to:

exists = PatternCount ( holidayList ; "= " & searchCrit ) ;

Jonathan Mickelson, Los Angeles
April 06, 2010 4:00pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 9 + 9 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions