Brian Dunning's FileMaker Custom Functions

ParseTime ( timeText )

This function parses and reformats time (hours and minutes) casually entered into a text field so that it can be converted to a valid time by Filemaker.

  Average rating: 4.3 (37 votes) Log in to vote

Fritz Mills   Fritz Mills
Media LightBridge, LLC
http://www.medialightbridge.com

Share on Facebook Share on Twitter

  Sample input:
1245
  Sample output:
12:45 PM

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

This function parses and reformats time (hours and minutes) casually entered into a text field so that it can be converted to a valid time by Filemaker. It also includes tests so that, if an invalid time string is entered, it will return an error message instead of an invalid time. Further, it incorporates code from the TimeMask custom function written by Steve Gerow of Abrazos Data Consulting that logically assigns AM or PM to times entered without that data between 7am and 7pm. Many thanks to Steve, and to Brian Dunning.

 

Comments

Lewis C. Lorenz   Lewis C. Lorenz, Tulsa, OK
Dec 17, 2015
Adding the following as the first Case element at the end allows an empty time entry to pass FMP validation when this function returns its result directly into a FMP time field.

Case ( isempty ( nums ) , "" , //Return the empty field so validation works.


This is a great custom function!
 
Ross Thompson   Ross Thompson, Rockford, IL
Jul 11, 2016
Remove the first line of this, "ParseTime ( timeText )" from the calculation body.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. 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 20 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: