Ham Posted August 14, 2005 Posted August 14, 2005 I have a date field, usually have to input like xx:xx in 24 hours format, can I change the input ways to xxxx in 24 hours format then system can auto turns to xx:xxAM or xx:xxPM? Thanks
Søren Dyhr Posted August 14, 2005 Posted August 14, 2005 Give this calc a whirl: Div ( GetAsNumber ( theTime ) , 3600 ) & Right("0"& Minute ( theTime ),2) --sd
Ham Posted August 14, 2005 Author Posted August 14, 2005 Dear SD I have try your calc, but can't make it work can you give me more detail how does your calc work? I have set field"theTime" format as number, and field of Calc as Time... anything more that I should know?
SlimJim Posted August 14, 2005 Posted August 14, 2005 Try this: Call your field TimeEntry I am assuming you data entry will consist of 4 numbers in the 24-hour format e.g. 1320 for 1:20PM. Set TimeEntry as a time field and then do the following Auto-entry by calculation uncheck Do not replace existing value GetAsTime(Left(Time;2) & ":" & Right(Time;2)) This converts your entry into a time and then you need to set the format on the layout to whatever you want it to look like. To have predictable results you need 4 digits.
comment Posted August 14, 2005 Posted August 14, 2005 You can also use Replace ( Right ( "0000" & TimeEntry ; 4 ) ; 3 ; 0 ; ":" ) This way you don't need to bother entering leading zeros.
Ham Posted August 14, 2005 Author Posted August 14, 2005 Thank you all, really thanks the information you provide were really helpful
Søren Dyhr Posted August 14, 2005 Posted August 14, 2005 (edited) Dear SD I have try your calc, but can't make it work can you give me more detail how does your calc work? I have set field"theTime" format as number, and field of Calc as Time... anything more that I should know? My aim was to avoid the display format to follow the OS prefs. So I consider textformat as the most flexible. But the reasoning behind is that the number of seconds in one entire day is 86400 and one hour is 3600 seconds. The way filemaker stores both date and time behind the screens is for time the number of seconds from the days beginning and days after the ac/bc threshold, so today is 732172. I do beyond these fact rely on typecasts in a few places in my calc, where the "&" is dedicating the result stronger than the rest. I've taken the liberty to sus ahead that if you have an OS pref that dictatates the use AM/PM formate, would the "," be the prefered to ";" in calc although it usually on my side of the pond is ";" ...but you're in Hong Kong - which very well might be a mixture??? --sd Edited August 14, 2005 by Guest
Recommended Posts
This topic is 7109 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now