Adam AIS Posted November 12, 2003 Posted November 12, 2003 I have, what I think is, a quick two part military time question. I've been reading my FileMaker book all night but just can't seem to get these to work. #1 I have a couple time fields. I have them setup as time fields under define fields and have them formatted as HHMM in 24 hour mode with a colon separator. When I enter a time such as 15:00 it works fine, however when I enter 1500 it makes it 1500:00. Any ideas? Do I have to write a calculation for this or am I just missing a setup step? #2 Is it possible to require that, for example, a start time is ahead of (or after in time) the insert time field. Are there any good tutorial links out there for something like this? As always my great thanks to all the help!
BobWeaver Posted November 12, 2003 Posted November 12, 2003 If you want to enter the time without separators, then you will have to use a calculation: Time(Int(TimeEntry/100),Mod(TimeEntry,100),0) You can use field validation to ensure that the input value is greater than or less than another field value. However, if you also have a date field, then you will have to take into account that 08:45, January 11, 2003 is later than 11:20, January 10, 2003. To do that, both time and date are combined into single time values before comparing them: ( (InputDate - StartDate)*86400 + InputTime - StartTime) > 0 will return a true value if the input date/time is greater than start date/time, and false otherwise. So this formula can be used directly as a validation formula.
Adam AIS Posted November 13, 2003 Author Posted November 13, 2003 Thanks... I'll play with that. One more... I have a button next to the time field which inserts the current time. How can I format the inserted time to be 15:06? Right now it gets inserted as 3:06:18 PM (for example) until I hit tab and then it formats, however it appears that it's still 3:06:18 PM it the database and it only displays 15:06. This is causing some problems with my calculations which are all based around a 15:06 time format. Thanks!
BobWeaver Posted November 14, 2003 Posted November 14, 2003 Formatting only affects the display after you tab out of the field. It has no effect on how the time is stored internally. Any calculations that use the time value will be using a number equal to the corresponding number of seconds past midnight. If you use the TimetoText() function the result will be determined by your system settings. So, to get something predictable it's better to use the following: Hour(Time) & ":" & Right("00"&Minute(Time),2)
Recommended Posts
This topic is 7680 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