|
Hi guys,
Need help with a javascript / maths problem.
I have a field which contains a number of minutes.
I need to convert this into hours and minutes though.
If I simply divide the field by 60, this gives me a DECIMAL ie. 350 (mins) divided by 60 returns 5.83 hours... but what needs to be returned is 5 hours 50 minutes. (or 5:50, more specifically)
Can anyone help with this? I'm thinking I will pass the minutes value to some sort of function.....
Gonzo
|
|
|
hi
If I simply divide the field by 60, this gives me a DECIMAL ie. 350 (mins) divided by 60 returns 5.83 hours... but what needs to be returned is 5 hours 50 minutes. (or 5:50, more specifically)
Can anyone help with this? I'm thinking I will pass the minutes value to some sort of function.....
take this example again
number is 350 mins
step1 ) first divide 350/60 == 5.83
then take int value means 5
it is show hours
step2)
take decmial no. : .83333
again multiply by 60
.833333 * 60 =49.99
approx value is 50
so answer is step1_value+step2_value/100
= 5 + 50/100
= 5.50
i hope u understand the logic,if doubt than ask again.
|
|
|
Heres a very simple way to convert Minutes into Hours and Minutes in ASP.
==ASP CODE==
TotalMinutes = 190 '190 is an example.
Hours = TotalMinutes \ 60
Minutes = TotalMinutes MOD 60
============
Enjoy.
Dan Journo
Kesher Communications http://www.KesherCommunications.com http://www.TextOver.com
|
|
|
|
|
|
|
// |