rivet Posted April 22, 2013 Share Posted April 22, 2013 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? Link to comment Share on other sites More sharing options...
David Jondreau Posted April 22, 2013 Share Posted April 22, 2013 I'll be looking forward to your updated calc! Link to comment Share on other sites More sharing options...
rivet Posted April 23, 2013 Author Share Posted April 23, 2013 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" ) Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 4031 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