Software Venture Consulting
ToMarket

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

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


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:  

RatingRatingRatingRatingRating
  Average rating: 4.1  (7 votes)
  Discuss this Custom Function

Lewis C. Lorenz, Attorney at Law
http://www.LorenzCom.com

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

Description:

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

Examples:
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 BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

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:
City/Location:
Comment:
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 7 + 2 =
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. CF.TurnIt ( ValueToTurn )
  (Wed, Jul 30, 12:32pm)
2. Patternize ( direction ; pattern ; replaceChar ; value ; pad? )
  (Fri, Jul 25, 5:48pm)
3. RequestSQL ( fieldDesired ; fieldKey ; valueKey ; valueType)
  (Fri, Jul 25, 7:31am)
4. isLeapYear ( _year )
  (Thu, Jul 17, 8:29am)
5. AgeCalculation( Date( 4 ; 12 ; 1980 ) ;
  (Thu, Jul 17, 8:10am)
6. ntBitwiseOperation ( ope ; base ; value1 ; value2 )
  (Wed, Jul 16, 11:22pm)
7. ntRepeat( times ; statements ; resultValueName )
  (Mon, Jul 07, 8:51pm)
8. ฺBookRentalCal ( BookingStart; 1.5)
  (Sat, Jul 05, 8:25pm)

RSS Feed of Custom Functions