kiwiora Posted September 19, 2005 Posted September 19, 2005 (edited) Hi guys, I'm trying to set up a database to convert data entered as mm.ss (e.g 2.30) into total number of seconds (i.e 2 minutes = 60 seconds, plus 30 seconds = 150 seconds) I have Minute ( time ) * 60 + Seconds ( time ) but that means my user has to enter in 0:02:30 Edited September 19, 2005 by Guest
RalphL Posted September 19, 2005 Posted September 19, 2005 I assume that the entry field will be a number and the calculation will be a number. Lets call the entry field Tms. Then Ts = Int (Tms) * 60 + Tms - Int (Tms) The integer part is minutes * 60 gives seconds The total - the integer gives the seconds.
kiwiora Posted September 19, 2005 Author Posted September 19, 2005 hmmm thanks but unfortunately that's not right... Int (tms) * 60 + tms - Int (tms) If you put in 1.5 (being 1 minute 50 seconds or 110 seconds total) it views the .5 as half (i.e the result is 60.5) so if you put the values in the equation. Int (1) * 60 + 1.5 - Int (1) = 60.5 so we need to convert the .5 to 50 seconds??
Søren Dyhr Posted September 19, 2005 Posted September 19, 2005 How about this: Let(tt=Substitute ( entry ; "." ; "|" ) & "0";Abs(Time(0;LeftWords ( tt ; 1 ) ; Left(RightWords ( tt ; 1 ) ;2)))) --sd
Raybaudi Posted September 19, 2005 Posted September 19, 2005 or about this: (I assume that the entry field will be a text and the calculation will be a text. Lets call the entry field Tms.) Let([ min = Left ( Tms; Length ( Tms ) - Position ( Tms ; "." ; 1 ; 1 ) ); sec = Right ( Tms; Length ( Tms ) - Position ( Tms ; "." ; 1 ; 1 ) ) ]; min * 60 + If ( Length ( sec ) = 1; sec & "0"; sec ) )
RalphL Posted September 19, 2005 Posted September 19, 2005 (edited) OK, a minor adjustment should fix this. Try the following: Int (tms) * 60 + (tms - Int (tms)) * 100 Edited September 19, 2005 by Guest Typo
kiwiora Posted September 20, 2005 Author Posted September 20, 2005 thanks RalphL i'm comparing mobile phone costs for my firm to evaluate the tenders we've received. So i've sorted out all the calcs to switch between per second billing and 30 second billing. i.e - the cost is given as per 30; but is billed per increment (1s or 30s) The issue I"m now having is rounding is based on .5, but in the calc, I need it to round up to the second (excuse the pun) it goes over the set increment. i.e my calc is Round ( seconds / carrier2increment ; 0 ) For example: seconds = 45 / 30 = 2 nice. but 31 / 30 = 1 it should equal 2 as well as it is over a 30 increment Hope that makes sense.... hope everyone's still looking into this post Thanks in advance.
RalphL Posted September 20, 2005 Posted September 20, 2005 Try using Ceiling instead of Round. Ceiling ( seconds / carrier2increment )
kiwiora Posted September 20, 2005 Author Posted September 20, 2005 You are my hero!! Thank you so much for all your help - ceiling is my new found friend Now if only I can hunt down all the millions of other secret squirrels i'm yet to discover. Thank you guys - you rock!
Recommended Posts
This topic is 7103 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