Converting textual dates in FileMaker

If you’re working with data from outside of FileMaker, you’ll commonly have to work with dates that FileMaker’s GetAsDate function won’t understand. To handle this, I created a custom function that allows conversion of a wide variety of date formats.

Some examples of how the function works:

  • GetTextAsDate (“07.19.01” ; “”)
  • GetTextAsDate (“Jan 19, 2007” ; “mmm dd, yyyy”)
  • GetTextAsDate (“20080616”; “yyyymmdd”)
  • GetTextAsDate (“Friday, Jan 19, 2007” ; “day, month dd, yy”)

These all equate to a FileMaker date output of 1/19/2007. Read the comments at the bottom of function for some limitations and non-obvious behavior.

If you’re new to FileMaker development, you’ll need to know that FileMaker Advanced is required to create, but not use, Custom Functions.

The GetTextAsDate function requires a helper function, GetMonthAsNumber. This is a trivial CF used to convert an English month name into its ordinal value:

I hope this helps with your conversion of dates!

Leave a Reply