Software Venture Consulting

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

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


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

FormatDateTime ( dateValue, timeValue, format )

Rate this function:  

  Average rating: 3.9  (52 votes)
  Discuss this Custom Function

Lewis C. Lorenz, Attorney at Law

Returns the dateValue or timeValue formatted as specified in format, using PHP-like coding, and allowing for escaped non-formatted text.

Sample Input:
FormatDateTime ( "12/31/2011", "", "l, F j, Y" )
FormatDateTime ( "12/31/2011", "10:11:25 AM", "Ymd His" )
FormatDateTime ( "12/3/2011", "", "\today is the \jS\ day\" )
Sample Output:
Saturday, December 31, 2011
20111231 101125
today is the 3rd day

 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


FormatDateTime ( dateValue, timeValue, format )

by Lewis C. Lorenz

9-22-2011 Created
11-29-2011 Modified
12-4-11 Modified
1-1-14 Modified

NOTICE: This is a recursive function. If you change the function name then also change it in the function code.

Returns the dateValue or timeValue formatted as specified in format.
If dateValue or timeValue are empty current date or current time are used.
Optionally use the backslash as an escape code to include text not intended to be formatted.
Escaped \ is written \\, all other escaped text must be enclosed within an opening \ and a closing \.
Formatting performed using PHP date() function format codes but with Filemaker conventions.

Passing '?' as the whole value of format returns this help text and the following code explanations.

Day -------
d - 01-31
D - Mon-Sun
j - 1-31
l (lowercase 'L') - Sunday-Saturday
N - 1 (Monday) ... 7 (Sunday). (PHP convention: ISO-8601 representation of day of week.)
S - st, nd, rd or th (English ordinal suffix.)
w - 1 (Sunday) ... 7 (Saturday). (PHP convention : 0 (for Sunday) through 6 (for Saturday).)
z - 1-366. (PHP convention: 0-365.)
Week -----
W - 1-54, week of year Jan. 1. (PHP convention: ISO-8601 week number of year, weeks starting on Monday.)
Month ----
F - January-December
m - 01-12
M - Jan-Dec
n - 1-12
t - 28-31
Year -----
L - Leap year (1/0)
o - year number. ISO-8601 year number.
Y - 4 digit year
y - 2 digit year
Time ----
a - am/pm
g - Hour 1-12
G - Hour 0-23
h - Hour 01-12
H - Hour 00-23
i - Min 00-59
s - Sec 00-59
u - Microseconds

FormatDateTime ( 9/21/2005, 11:06:53, "Y-m-d His \zulu\") = 2005-09-21 110653 zulu
FormatDateTime ( 10-3-2011, "", "\today is the \jS\ day\") = today is the 3rd day

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

This is my Custom Function and I want to edit it


There are no comments yet. Be the first to post a comment about this Custom Function! Please try to keep it brief & to the point. Anyone can post:

Your Name:
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 6 + 6 =
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. uNmbr_00ConvertToNativeNumberAndEvaluate__CF ( stringToTreat )
  (Wed, Feb 22, 12:35pm)
2. GetMatchValueInList (ValueList, Seperator, MatchText)
  (Sat, Feb 18, 12:07pm)
3. PatternCountMultiTotal ( Text ; SearchList, CaseSensitive)
  (Fri, Feb 17, 2:37pm)
4. recta
  (Thu, Feb 16, 4:36pm)
5. Phone.Format.AUS ( PhNumber )
  (Sat, Jan 21, 2:58pm)
6. GetItemName (Path)
  (Fri, Jan 20, 3:07am)
7. countUpHTML ( startVal, endVal )
  (Wed, Jan 11, 11:24pm)
8. CurrencyFlex ( Input )
  (Tue, Jan 10, 8:15am)

RSS Feed of Custom Functions