Brian Dunning's FileMaker Custom Functions

ISO8601 ( source_date ; parameter )

Versatile function to covert and/or validate date inputs to YYYY-MM-DD text

  Be the first to rate this function Log in to vote

RealGrouchy   RealGrouchy - Show more from this author
https://realgrouchy.blogspot.com

  Sample input:
ISO8601 ( "2026/15/04" ; "date" )
  Sample output:
2026-04-15

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

This function takes date inputs in various specified or unknown formats and coverts it to YYYY-MM-DD text format, or can be used to validate whether a given input is in YYYY-MM-DD format. (When I need to write to a date field, I couple it with another function that converts YYYY-MM-DD to FM date format). This is useful when receiving date inputs from interfaces that don't validate or standardize the date format, or from ones that consistently supply the date in a particular non-ISO format.

It will accept inputs in the format YYYYMMDD, ####-##-##, #/#/####, ##/##/####, and many variants of these. The year must be the first or last component.

If the input string contains a letter or a space, it will only evaluate the portion that comes before that space or letter.

If the input string is invalid despite attempts to correct it (see 3rd bullet below), it will return the original value unaltered.

 

Comments

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 22 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: