April 22, 201312 yr I found a nice custom function in the comments of this CF That allows a user to quickly enter times. Let( [ tt = Int( Substitute( Choose( Length( textfield ) - 1; "ç00"; "ç00"; "ç"; "ç" ); "ç"; textfield ) ); ts = Case( Div( tt - 100; 1200 ); 100 + Mod( tt - 100; 1200 ); tt ) ]; Replace( ts; Length( ts ) - 1; 0; ":" ) & " " & Case( Position( Lower( textfield ); "p"; 1; 1 ); "P"; Div( tt - 100; 1200 ); "P"; "A" ) & "M" ) But there are a few bugs: 00 = 12:00pm 10p and up = 12:00pm Plus I would like a tweak: let "." convert to 'pm' (for users with extended keyboards) any ideas?
April 23, 201312 yr Author spoken like a true father David. Okay it could be streamlined. But I fixed the 10p–12am entries, default is PM and a '.' (period) equal AM Let([ start = Lower ( textfield ) ; value = Filter ( start ; "1234567890" ) ; tt = Int( Substitute( Choose( Length( value ) - 1; "ç00"; "ç00"; "ç"; "ç" ); "ç";textfield) ); ts = Case( Div( tt - 100; 1200 ); 100 + Mod( tt - 100; 1200 ); tt ) ; tc = Replace( ts; Length( ts ) - 1; 0; ":" ) ; dv = Abs (Div( tt - 100; 1200 )-1) ]; tc & " " & Case( Position( start; "a"; 1; 1 ) or Position( start; "."; 1; 1 ) ; "A"; dv =1; "P";dv =2; "A"; dv =0; "A"; "P" ) & "M" )
Create an account or sign in to comment