If I understand you correctly, jayankurian, you want to ENTER military time without *** the ":". for example "1300". Then you want it to FORMAT as 24 hour clock as "hh:mm" (leading 0 or not).
Is that correct?
See this help topic:
You can only ENTER a time field using the ":". If, however you want, you can create a TEXT field for entry, you can "auto-enter" the TIME field using that text.
There may be other suggestions...
This used to be a PITA, but I believe it now can be handled with script triggers.
Thank you for your immediate response.
Yes, I would like to enter 1320 into my field(of course it is a time field) and the field should display 13:20.
Later I need to do some calculation with this time field(finding elapsed time - which means, calculating how many hour and minutes it took to complete from STEP 1 to STEP 2 and STEP 2 to STEP 3 etc.
Time entry has been done by various clerical staff in my department. Clerks are not enthusiastic to insert the ":" while they enter the time in miliary format, probably it slows down their speed because they need to hold down the shift key and enter the colon, most of the time they use the number area of the keyboard for input.
Thanks again for your suggestion.
Please state your version.
v 11 Developer
Try attaching an OnObjectValidate script trigger to the field, with a script that sets the field =
t = GetAsText ( YourTable::Timefield )
Time ( Div ( t ; 100 ) ; Mod ( t ; 100 ) ; 0 )
Your suggestion was good. OnObjectValidate script trigger worked.
Thanks again Michael, also thanking others who made good suggestions.
I like the trigger calc, what can I do to add seconds also.
Example: enter 063045 will show 06:30:45 in military time. 230545 will show 23:05:45
A fast'n'dirty solution is to parse out the components using Left(), Middle(), and Right(), and pass them as arguments to Time().
You'll probably want to check the length and format of the entered string, and maybe also allow for the entry of just hours and minutes.
I realize that this thread is few years old however I'd also like to thank you for the script trigger
solution. One question ... the current output includes seconds ( e.g. 16:45:00)... is it possible to
generate a result with hrs:min only?