Posted By
|
Message
|
lembi2001
Registered 01/04/2005
Points 608
|
20th October, 2006 at 13:14:44 -
I am looking to create an application that will alow me to record th hours i have worked over a five day week. I have found a problem that i cannot solve. i want to be able to add up hours and mins, hwever MMF cannot add time units together. eg it will add 1hr 30 mins and 1 hr 45 mins as 2hrs 75 mins. see the problem??? can anyone help?
n/a
|
David Newton (DavidN) Invisible
Registered 27/10/2002
Points 8322
|
20th October, 2006 at 13:27:46 -
Store everything as a number of minutes, use "minutes mod 60" to actually display them and use "floor(minutes/60)" to get the number of hours.
http://www.davidn.co.nr - Games, music, living in America
|
Joe.H Evil Faker
Registered 19/08/2002
Points 3305
|
20th October, 2006 at 13:29:07 -
convert it all to minutes, and go from there. Add the minutes together, so you get 205 minutes worked. Divide by 60 (you'll need to make a system that stores it as an exact value somewhere, so you can then work with the tenths and hundredths to find the minutes)
My signature is never too big!!!
|
lembi2001
Registered 01/04/2005
Points 608
|
20th October, 2006 at 13:37:40 -
thanks for the qiuck replies. i have just had a look at a way of creating the time sheet and i have realised that i will need to create four input fields for the day i have worked. e.g
Time in Time out TIme In Time out
08:45 12:00 13:00 17:00
it would then need to work out the time frames in between the 2 in and out fields. (make sense???).
n/a
|
lembi2001
Registered 01/04/2005
Points 608
|
22nd October, 2006 at 11:46:50 -
Sorry to bump but i cant get Minutes Mod 60 to work.
n/a
|
[blanco]
Registered 09/09/2006
Points 23
|
22nd October, 2006 at 22:27:26 -
"Sorry to bump but i cant get Minutes Mod 60 to work. "
Do this and you'll understand:
Make FOUR counters and name them "Time", "Hours", "Minutes", and "Seconds"
Add the follwong events:
Every 1 second
Add 1 to "Time"
Always
Set "hours" to value("Time") / 3600
Set "Minutes" to value("Time") / 60
Set "Seconds" to value("Time") mod 60
This is just an example, tho. You sould never use the 'Every" condition or else your game will not run consistantly on different machines.
n/a
|
|
|