Jump to content

This topic is 7102 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm sorry if I post in wrong forum..

My question is it's possible to enter time in field with format time without enter ":", for example if I enter 830 it will show 8:30.

I need your kind suggestion...

Thank you for your kind attention

Thx

Ben

Posted

Hi

I assumed that the field "Time" is a text field with option of auto-enter calculation replaces existing values and calc:

Case(

Length ( Time ) = 0;"";

Length ( Time )  ≤  2 and GetAsNumber ( Time ) ≤ 24; Right ( "0" & Time ; 2 ) & ":00";

Length ( Time )  =  2 and GetAsNumber ( Time )  >  24  and  Right ( Time ; 1 ) < 6; Right ( "0" & Left ( Time; 1 ) ; 2 ) & ":" & Right ( Time ; 1 ) & "0";

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

Length ( Time ) = 4; If ( Left ( Time; 2 ) = "24";  "00:" & Right ( Time ; 2 );Right ( "0" & Left ( Time; 1 ) ; 2 ) & ":" & Right ( Time ; 2 ));

"?"

)

So the calc gives:

for one char (eg 2) :) 2:00

for two char (<=24) (eg 23):) 23:00

for two char (>24) (eg 83): 08:30

for tree char (eg 123): 01:23

for four char (eg 2423): 00:23

You can check if I omitted some situation !

Posted

For version 6, if you will be entering hours and minutes in 24-hour time, then you can use a text field for entry and stack a calculation time field, which does not allow entry, on top of it, equal to

Case( not IsEmpty(textField),

Time( Left( Right( "0000" & textField, 4 ), 2 ), Right( Right( "00" & textField, 2 ), 2 ), 0 )

)

You can then format the time calculation field to display as desired and reference it in place of the text field.

Posted

Hi Queue

sure... your calc is better then mine !

(but gives some strange result if you write something like this:

2412 = 24:12

2512 = 25:12

Also, if I write 61, I think I writed 6:10 but FM gives (correctly) 1:01 (not so human)

Posted

That is why I stated the field can be formatted as desired. If, for example, it is formatted as hhmm with 12-hour notation, then

2412 = 12:12 AM

2512 = 1:12 AM

Although, if one is entering actual 24-hour time, as opposed to elapsed time or something similar, then 2512 would be a typo.

Posted

Although, if one is entering actual 24-hour time, as opposed to elapsed time or something similar, then 2512 would be a typo.

Yes...this I quoted.

BTW I said that your calc is better ! ;-)

This topic is 7102 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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