Brian Dunning's FileMaker Custom Functions

formatTime ( numbersOnlyMilitaryTime )

Takes input of numbers (only) and converts to properly formatted military time

  Average rating: 4.6 (31 votes) Log in to vote

Timothy Hall   Timothy Hall
beezwax datatools, inc.

Share on Facebook Share on Twitter

  Sample input:
formatTime ( "234" )
formatTime ( "0234" )
formatTime ( "23456" )
formatTime ( "023456" )
  Sample output:

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

Use with either a numeric or time field.
Will convert number-only entries into hh:mm:ss military time format.

Make the field a number field with an auto-enter calculation of..
If( IsEmpty( Self ) ; GetAsText("hhmmss") ; GetAsText(formatTime( Self )) ).
NOTE: You can also use conditional formatting to display the "hhmmss" prompt in the field as a dimmed value.
Set the auto-enter calculation with "Do not replace.." (unchecked).

CAVIET: if you use a time field, once a value has been entered, and then the field value is deleted by the user, the "hhmmss" prompt will display a question mark.
The WORK-AROUND: use an additional conditional formatting rule to hide the question mark.

FINAL NOTE: for use with FMGo in the iPad or iPhone, time fields do not support military time (as of this writing), and users will have to enter standard time values - the field's time format can be set in the inspector to display the result in military time though.

If time-range searches will be needed, you could use a second calculation field, set to time, that displays the value of the converted number field; place the time field over the number field on your layout, and set the time field for entry in find mode, and the number field for entry in browse mode - this would cover the range searches in find mode.




jcm38   jcm38, Grenoble
May 21, 2014
Thank you for this usefull function.

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

Under construction. Email me your wish list for improvements.