Military Time To Standard Text

From Dwayne Wright PMP - Certified FileMaker Developer
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Many folks try to use time calculations to represent something that is going to happen in the future. For example, you take the current time and add X amount of time. The problem is the calculated result tends to be shown in military time. So instead of getting 1:30 PM, they end up with 13:30. This is the default method that FileMaker will show a result of a time based calculation.

So in this layout, we have three examples of time. The data entered is 1:20:34 PM in the first field but if you click into the field, you see the actual value is 13:20:34.

FIXING IT THE LAYOUT METHOD ... This requires you enter layout mode, click the field, choose number option under the Format menu and choose the AM/PM option. However, this is just the way it is viewed. The math is still in military time. This can cause a problem if you using the field in a word processing merge, in an email or other method.

FIXING IT VIA A FUNCTION... There is a method ... of course .. that can benefit from your knowledge of FileMaker functions. Here is an example using a time field called “Result Time.”

IsEmpty(Time Example), "",
Time Example < 3600, 12,
Hour(Time Example) - Case(Time Example >= 46800, 12))
& ":" & Right("0" & Minute(Time Example), 2) &
Case(Time Example < 43200, " AM", " PM")

and be sure to save your calculation as a text result!

An example file can be downloaded by clicking (here)

© 2008 - Dwayne Wright -

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.