Dumb and Basic, Dumb Nick

LeftSecs=MOD(Insecs,3600)

Hours=(Insecs-LeftSecs)/3600
or
Hours=INT(Insecs/3600)
or
Hours=QUOTIENT(Insecs,3600)

Minutes=(LeftSecs-MOD(LeftSecs,60))/60
or
Minutes=INT(LeftSecs/60)
or
Minutes=QUOTIENT(LeftSecs,60)

Seconds=LeftSecs-Minutes*60
 
Last edited:
Hours=MOD(Insecs,3600)
LeftSecs=Insecs-Hours*3600
Minutes=MOD(LeftSecs,60)
Seconds=LeftSecs-Minutes*60
close but not quite
hours = floor(insecs/3600) note floor might be call (int)
leftSecs = mod(insecs,3600)
minutes = floor(leftSecs/60)
seconds is fine.

Joe
 
close but not quite
hours = floor(insecs/3600) note floor might be call (int)
leftSecs = mod(insecs,3600)
minutes = floor(leftSecs/60)
seconds is fine.

Joe

Yeah. I feexed. (I think I still got it wrong. Revised again. I guess I can't think right without really hacking at it. )

The QUOTIENT formula is in OpenOffice.
 
Last edited:
Actually your all wrong there is a much easier way to do it. Just post the question on POA and someone will give you the answer LOL:D
 
Nick--you wanting to do this in Excel or as part of an existing application? If so, which langauge?
 
I was doing it in php. Just needed the basic knowledge of what math to do.
Ah I see. You could have just googled "php convert seconds to hours minutes" and found about a billion code examples...Some really nice powerful time classes out there.
 
I actually did that, and found a bunch of examples that were either wrong, or were trying to convert lat/long.
Converting degrees, minutes, and seconds to decimal degrees, or vice versa, is just the same as converting hours, minutes, and seconds to decimal hours.
 
int seconds;
int minutes;
int hours;
int days;

minutes = seconds / 60; // calc number of whole minutes.
seconds = seconds % 60; // calc remainder number of seconds.

hours = minutes / 60; // calc number of whole hours.
minutes = minutes % 60; // calc remainder number of minutes.

days = hours / 24; // calc number of whole days.
hours = hours % 24; // calc remainder number of hours.

answer = days " days, " hours " hours, " minutes " minutes, " seconds " seconds.";

// convert to the language of your choice.
 
Last edited:
Back
Top