Brian Dunning's FileMaker Custom Functions

Military Time ( TimeField )

This function converts a Filemaker time field to military time.

  Average rating: 4.7 (30 votes) Log in to vote

John Leyman   John Leyman
Loma Linda University

Share on Facebook Share on Twitter

  Sample input:
Military Time ( 4:40:36 PM )
  Sample output:

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

This function gives an HHMM display of a Filemaker time capture fields in the format of HH:MM:SS xM where x="A" or "P" (for the before or after 12 noon AM or PM).

This function converts to military (24-hour) time and also removes the colons and seconds display. This function could be changed slightly to include the display of seconds by searching for the second colon and taking the two digits to the immediate right of the second colon.



comment   comment, VR
Sep 6, 2011
How about:

SerialIncrement ( "0000" ; 100 * Hour ( time ) + Minute ( time ) )
ian   ian, nassau
Sep 13, 2011
Yep .. Too much complexity you dont need to know am & pm for military. just hundred hours,etc.

VR. great way - VERY SIMPLE
Steve Roethel   Steve Roethel, Mendon, NY
Jan 3, 2012
I have this to convert a military entry in to a time field without manually entering the colon separators.

Time( Left( Self ;Choose( Length( Self );0;1;2;1;2));
Right( Self ;Choose( Length( Self );0;0;0;2;2));

This simple calc works great, except, I NEED the seconds included. The calc above drops the seconds to "00". Also, It won't allow an alteration of a "MM" or "HH" if incorrectly entered. The entire time must be re-entered. Can you help?

This is what I need:

Entry: "235120"
Result: "23:51:20

MAC 10.6.8
Steve Roethel   Steve Roethel, Mendon, NY
Jan 3, 2012
Disregard the previous post/comment, I found the calc I was looking for on one of your other pages.

Steve R
Ray C   Ray C, Perth West Australia
Feb 5, 2013
This doesn't work between 1200 noon and 1259. It outputs 2400 to 2459.
Rocio   Rocio, Houston, TX
Nov 12, 2014
It does not work for 12:00 AM to 12:59 AM or for 12:00 PM to 12:59 PM
admin   admin, internet
Apr 27, 2018
This is poorly written. I wouldn't use this at all. It should be wrapped in a GetAsTime, there is a much simpler way to do things other than Right & Left and as stated this doesn't work in 100% of the cases.


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.