codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  convert minutes into hours and minutes  DoctorGonzo at 10:56 on Monday, May 22, 2006
 

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

  Re: convert minutes into hours and minutes  miteshbhimjiyaani at 11:41 on Monday, May 22, 2006
 

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.



  Re: convert minutes into hours and minutes  KesherCommunications at 14:51 on Wednesday, July 05, 2006
 

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


  Re: convert minutes into hours and minutes  schuiazza at 09:52 on Tuesday, August 14, 2007
 

Hello,

Can u please send me the code for the above probelm, I am trying to convert minutes to hours and minutes.

i would appreciate if u could send it at my email schuiazza@yahoo.com

Thanks

  Re: convert minutes into hours and minutes  Flashley630 at 06:45 on Monday, May 19, 2008
 

Hey KesherCommunications

Thanks for posting that.

It helped me solve a visual basic application that i've been stumped on all day.



  hi friend sorry for this , i dnt know how to post , so i give reply to u  durairaj1857 at 06:48 on Tuesday, June 17, 2008
 

i have to get all controls of a form

using javascript

actually in my form

there are 2 set of controls

for example

user1 user 2
----------- ----------
txtbxu1 txtbxu2
ddlbxu1 ddlbxu2

like this i have many controls

what i have to do is, if i select user1 or user2


the next user willbe disabled

hw to do this using javascript

not hiding but i have to disable the user1 controls if i select user2, or i have to disable user2 if i select user1.


ok for this , i have to get all controls of the form using javascript

and after tat i have chk in a forloop tat if the control ends with u1, or u2 depends upon my selection

i have to disable


let me know how to get alll controls of a form and how to chk whether it ends with u1 or u2

let me know.

i need a answer for this


  Re: convert minutes into hours and minutes  MattoThePotatto at 07:43 on Wednesday, June 25, 2008
 

Hey.
350 minutes is 5 hours 50 minutes...
<script type="text/javascript">
var Hours = Math.floor(350/60);
var Minutes = 350%60;
var Time = Hours + ":" + Minutes;
...
</script>
.. That should give you the conversion of minutes to hours+minutes..








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
• I Need Help
• User input validation
• Create a wrapper for a COM Dll
• HashMaps
• HashMaps
• NEED HELP! Urgent
• Re: Exciting Open Source Project in C++
• Re: The Ballarat Airline Company (BAC)
• Re: problem getting prompt window to work on IE


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008