Brian Dunning's FileMaker Custom Functions

UltraDate ( Text ; LongDate_or_DateDigit )

For accommodating dates outside the 4000-year date range of native FileMaker date fields

  Average rating: 4.8 (25 votes) Log in to vote

Allan Hunter   Allan Hunter - Show more from this author
Independent FileMaker Solutions Developer

Share on Facebook Share on Twitter

  Sample input:
UltraDate ("12/31/0001 BC"; "LongDate")
  Sample output:
Sunday, December 31, 1 BC

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

Allan Hunter, FileMaker Solutions Developer, 2012
UltraDate, a custom function for accommodating dates outside the 4000-year date range of native FileMaker date fields
Input: text containing date strings of the format month/day/year {BC or BCE for dates before 1/1/0001};
2nd parameter determines what is returned: LongDate is day of week, month day, year e.g., Sunday, December 31, 4000;
DateDigit is the serial number of that date, indexed to 1/1/0001 =1, same as what you get from GetAsNumber (Date)
in a true native FileMaker date field, hence useful for sorting and doing finds on date ranges and using for relationships.



SAMPLE INPUT AND RESULTS
------------------------------
"12/31/4000, LongDate" Sunday, December 31, 4000
"1/1/4001, LongDate" Monday, January 1, 4001
"1/1/0001, LongDate" Monday, January 1, 1
"12/31/01 BC, LongDate" Sunday, December 31, 1 BC

"12/31/4000, DateDigit" 1460670
"1/1/4001, DateDigit" 1460671
"1/1/1, DateDigit" 1
"12/31/0001 BCE, DateDigit" 0

"12/30/1 BC, LongDate" Saturday, December 30, 1 BC
"12/30/1 BC, DateDigit" -1
"5/1/9012, LongDate" Friday, May 1, 9012
"3/19/7200 BC, LongDate" Tuesday, March 19, 7200 BC
"3/15/44 BC, LongDate" Saturday, March 15, 44 BC
"10/23/4004 BC, DateDigit" -1462134
"6/13/876347 BCE, LongDate" Sunday, June 13, 876347 BC

ahunter3@earthlink.net

 

Comments

Allan Hunter   Allan Hunter, Independent FileMaker Solutions Developer
May 2, 2012
I'm rather klunky with recursive functions. Feel welcome to improve or offer comments for improving if you see more elegant ways of going at it.

Short of a (Gregorian) calendar showing dates before 1/1/0001 or after 12/31/4000 to compare, I can only try a few that are close enough to dates natively handled by FileMaker to verify that the DayNames and DateDigits are as they should be, but within those limitations they seem to be. (I found a few references to ancient dates that mention the day of week which are different than what I get via this CF, but I have reason to believe those are old Julian calendar dates or even older calendar formats and hence not relevant).
 

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: