formatTime ( numbersOnlyMilitaryTime )
Takes input of numbers (only) and converts to properly formatted military time
Average rating: 4.6 (31 votes) Log in to vote
beezwax datatools, inc.
formatTime ( "0234" )
formatTime ( "23456" )
formatTime ( "023456" )
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.
May 21, 2014
Thank you for this usefull function.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.