math question! - calculate time

Sidle up to the bar (Lightly Moderated)

Moderator: Dictators in Training

Post Reply
Naethyn
NT Traveller
NT Traveller
Posts: 2085
Joined: Wed May 04, 2005 12:13 pm

math question! - calculate time

Post by Naethyn »

Anyone know a formula to calculate total amount of time elapsed?

Say its 09:03am and you want to find out how long of a time passed at 4:57pm.

It seems like an easy question and maybe a full day of work has shut my brain down but I can't think on a formula to calculate it.

I'm not looking for the answer but how you arrived at the answer!
User avatar
Ganzo
Dictator in Training
Dictator in Training
Posts: 2648
Joined: Thu Mar 18, 2004 9:05 pm

Post by Ganzo »

millitary time.
4:57pm = 16,57
09:03am = 9,03

16,57 - 9.03 = 7,54

elapsed time is 7 hrs and 54 min

:dunno:
גם זה יעבור

Narrock wrote:Yup, I ... was just trolling.

Narrock wrote:I wikipedia'd everything first.
User avatar
Phlegm
Nappy Headed Ho
Nappy Headed Ho
Posts: 6258
Joined: Tue Aug 03, 2004 5:50 pm

Post by Phlegm »

Ganzo wrote:millitary time.
4:57pm = 16,57
09:03am = 9,03

16,57 - 9.03 = 7,54

elapsed time is 7 hrs and 54 min

:dunno:



not alway correct since time is base 60 not base 10.
Last edited by Phlegm on Thu Jun 01, 2006 5:25 pm, edited 1 time in total.
User avatar
Dylan
NT Patron
NT Patron
Posts: 5229
Joined: Mon Mar 15, 2004 11:11 am
Location: Seattle

Post by Dylan »

Buy a watch.
User avatar
Gidan
Admin Abuse Squad
Admin Abuse Squad
Posts: 2892
Joined: Tue Jan 04, 2005 11:01 am

Post by Gidan »

Convert to military time first

Next convert both times into minutes
Start Time in Minutes = Start Hour * 60 + Start Minute
End Time in Minutes = End Hour * 60 + End Minute

Get the Difference between the 2
If Start Time in Minutes > End Time in Minutes
Total difference in minutes = 1440 - Start Time in Minutes + End Time in Minutes
If End Time in Minutes > or = Start Time in Minutes
Total difference in minutes = End Time in Minutes - Start Time in Minutes

Determin the number of minutes passed
Total Minutes passed = Total Difference in Minutes MOD 60

Determin the number of hours passed
Total Hours passed = Total Difference in Minutes DIV 60

Your elapsed time
Total Elapsed time = Total Hours Passed : Total Minutes Passed


Its not quick but it will give you the time your looking for. Its the easiest way to deal with the minutes.
For to win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
User avatar
Phlegm
Nappy Headed Ho
Nappy Headed Ho
Posts: 6258
Joined: Tue Aug 03, 2004 5:50 pm

Post by Phlegm »

The easiest way to find the time is by adding instead of subtracting.

For instance: time elapsed between 3:48 am and 7:25 pm:

12 minutes to 4 am.
15 hours between 4 am to 7 pm.
25 minutes between 7 pm to 7:25 pm.

add them up 15 hrs+25minutes+12 minutes = 15:37 is the time elapsed.

By adding you don't have to worry about the converting.
brinstar
Cat Crew
Cat Crew
Posts: 13142
Joined: Tue Mar 09, 2004 1:45 pm
Location: 402

Post by brinstar »

math :-x
compost the rich
Griever
NT Veteran
NT Veteran
Posts: 1283
Joined: Fri Apr 02, 2004 8:34 am
Location: Northern Virginia

Post by Griever »

brinstar wrote:math :-x
User avatar
Granh
NT Froglok
NT Froglok
Posts: 184
Joined: Fri Mar 12, 2004 1:57 pm
Location: Dallas, TX
Contact:

Post by Granh »

? = ((AE+12)-AS)
AE = Absolute End
AS = Absolute Start

Convert the minutes to an absolute by dividing them by 60. This will return a number easier to work with.

I.E.
9:03 would convert to 9.05 (3 divide 60 = 0.05)
4:57 would convert to 4.95 (57 divide 60 = 0.95)

If you take these numbers and this formula you can find the absolute difference.

? = ((4.95+12)-9.05)

? = 7.9

Take the decimal and convert it back by multiplying 60 by the decimal in % form.

0.9 = 90% (60*90%=54)

Elapsed Time = 7:54

Example was easier done with just military but if end minutes is less than start minutes this is faster.

9:47am to 8:12pm?

? = ((8.2+12)-9.78)
? = 10.42
Elapsed Time = 10:25
Kitty Litter for the Mind
User avatar
Phlegm
Nappy Headed Ho
Nappy Headed Ho
Posts: 6258
Joined: Tue Aug 03, 2004 5:50 pm

Post by Phlegm »

I think my way is still faster.
Post Reply