Brian Dunning's FileMaker Custom Functions

date.format ( theDate ; format )

A function to return a date in a text format specified at the time.

  Average rating: 3.7 (69 votes) Log in to vote

Tim Anderson   Tim Anderson - Show more from this author
Tim Anderson Group

Share on Facebook Share on Twitter

  Sample input:
date.format( get(currentdate); dd-mon-yy)
  Sample output:

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

A function to return a date in a text format specified at the time.


date.format( get(currentdate); dd-mon-yy) - returns 03-Aug-08

Requires Other Custom Functions:

Other Notes:
Uses substitute function so is very simple for you to add your favourite abbreviation - just watch the substitution order!.
Thought I'd seen something like this before, but couldn't find it

Updated 19 March 2018 to my current use because if new comments. Replaced 'dn' with 'dn3' to stop issues with Wednesdays and removed the extra entry for 'year'



Will Loving   Will Loving, Dedication Technologies, Inc.
Oct 11, 2013
There is a problem with your variables. If the day of the week is Wednesday, then using "dname" correctly calculates "Wednesday" but then the next substitution for "dn" re-writes the "dn" in Wednesday to "WeWedesday". It's easy enough to use a different variable name but I thought I would point out the problem.
beverly   beverly, KY
Apr 2, 2016
I think I'd add 'm' (not padded) and 'd' (not padded). or perhaps I'd look at the way PHP handles date string functions (using the same "formats"):
just to make it consistent in this function. So month would have 'F', 'm', 'M' or 't' choices.
kevin rehak   kevin rehak, collegeville, PA
Mar 15, 2018
make sure to add quotes around format.

date.format ( date ; "mm-dd-yyyy" )
Richard DeShong   Richard DeShong, Logic Tools
Mar 19, 2018
Hi Tim, noticed that "year" is listed twice.
Tim   Tim, JEAMA
Mar 19, 2018
Thanks Richard. I had changed this in my solution along ago, removing the extra 'year'. But your comment and made me realise I had not updated this with the fix for wednesdays - now updated.
Beverly, I know next to nothing about php, I would imagine for those that would want consistency across their platforms they could easily follow what I have done here and tweak it for their own preference.
Ed   Ed, Santa Cruz
May 26, 2018
It's very sad that something that ought to be straightforward and simple as formatting a date field is barely accomplished using complex Rube Goldberg methods. Also, beg the question as to why my CurrentDate field no long formatted as desired and also prints the year using Japanese characters.
Jan 25, 2019
I need to name files as follows : YYYYMMDDHHMNSS (for sample 20190125160504)
Is there such a function in your rich library ?
Tim Anderson   Tim Anderson, Tim Anderson Group
Jan 31, 2019
I have just uploaded a new cf - FilenameFromTimestamp - that should be available soon. Should be easy too tweak if you need

Log in to post comments.


Note: these functions are not guaranteed or supported by 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: