Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Use Calculation to format a time field

Featured Replies

I am attempting to use an auto enter replace existing values calculation to make entering data into a time field more efficient. I am trying to be able to enter numbers only without the :) and without am or pm in military time. I can enter in military time but have to use to :) and I am trying to skip that. So, I have develolped the following calculation but it doesn't seem to return the correct results. Can anyone find my error?

Case ( ApptTimeStart Calc ≥ 959 and ApptTimeStart Calc < 1200 ; Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 2) & ":" & Right(Digits; 2) & " am" ; ApptTimeStart Calc ≥ 1200 and ApptTimeStart Calc ≤ 1259 ; Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 2) & ":" & Right(Digits; 2) & " pm" ; ApptTimeStart Calc ≥ 1300; Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 2) & ":" & Right(Digits; 2) & " pm" ;Let (Digits = Filter(ApptTimeStart Calc; "0123456789"); Left(Digits; 1) & ":" & Right(Digits; 2) & " am"))

Paul

Hi

the "error" was to try to enter "am" or "pm" into the field.

Also( but this isn't an error )you haven't to make so many "Let"... one is enough ! :)

Give a try to this calc:

_________________________________________________

Let([

Digits = Filter(ApptTimeStart Calc; "0123456789")

];

Case (

Length ( Digits ) = 1 ;Left(Digits; 1) & ":00" ;

Length ( Digits ) = 2 ;Left(Digits; 2) & ":00" ;

Length ( Digits ) = 3 ;Left(Digits; 1) & ":" & Right(Digits; 2) ;

Length ( Digits ) = 4 ;Left(Digits; 2) & ":" & Right(Digits; 2);

""

)

)

_________________________________________________

If you want to see the final result as:

12:23 pm you have to format, in layout mode, the field with your desired criteria in the menu Format-->Time...

Try:

Replace ( Right ( "0000" & TimeField ; 4 ) ; 3 ; 0 ; ":" )

Note:

Filemaker accepts military time entry - so there's no need to convert it to am/pm style.

Filemaker does NOT accept non-numeric characters in time fields (unless you are entering proper time, eg. "11:00 pm") - so there's no need to filter them out.

These two threads might be of interest:

http://www.fmforums.com/forum/showtopic.php?tid/163130/post/163131/#163131

http://www.fmforums.com/forum/showtopic.php?tid/149062/post/163951/#163951

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.