473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Min to hours convertion problem

32
Hi Here is my Code. Iam trying to convert min to hours. buts its coming 160.5 instead of 160.3.help me in that pls..


Expand|Select|Wrap|Line Numbers
  1. while($res_proj_hrs = mysql_fetch_object($qry_proj_hrs))
  2.                                 {
  3.                                     $hr   = $res_proj_hrs->hrs;
  4.                                     $min  = $res_proj_hrs->mins;
  5.                                     if($hr || $min){
  6.                                         $getHour =getCorrectTime($hr,$min);
  7.                                         $totmin = $hr * 60 + $min;
  8.                                         $tothour += $totmin;
  9.                                     //$tothour = $tothour + $getHour;
  10.                                     }
  11.                                     else
  12.                                         $getHour = "0.00";
  13.  
  14. //Print line
  15. <td  align='center'><?php echo $tothour / 60 ?></td>
  16.  
  17.  
regards
apking
Mar 7 '11 #1
2 1491
Rabbit
12,516 Expert Mod 8TB
If you're talking about 9630 minutes then that is 160.5 hours. Or 160 and a half hours. That's correct. 160.3 hours would be wrong.
Mar 7 '11 #2
Or if you are trying to display it like a digital clock, in hh:mm format. Try something like this.
Expand|Select|Wrap|Line Numbers
  1. $tothour=9630;
  2.  
  3. $h=intval($tothour/60);
  4. $m=$tothour%60;
  5.  
  6. echo $h.':'.$m;
Mar 7 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: R.A. Joemman | last post by:
Hi, We are migrating a database from Oracle 8.1.7.0.0 to Oracle 9.2.0.1.0 on AIX. Export as follows: exp ${user}/${pwd} compress=n file=${file} log=${log} owner=${schema} grants=y indexes=y...
1
by: Jonathan | last post by:
Hi, i am having a hard time trying to convert my date. Here is my problem : I get an input date from a user in a form (in a asp:textbox control). The date is validated with the "dd/MM/yyyy"...
6
by: Chiller | last post by:
I'm in the process of writing a class that performs functions on a Distance object. The object is created by entering details as "Distance a (5, km)" or "Distance b (3, cm)" etc. I wish to write...
1
by: tsunami | last post by:
I have written a bitarray class which has a constructor taking bit stream as a string parameter.but it gives me an error such that cannot convert 'char*' to 'unsigned char*'.where I have declared...
8
by: Rob T | last post by:
I run dual displays on my machine with Visual Studio 2003. Does anyone have a problem when you minimize than maximize the VS program, that you get a phantom window to also show up between the 2...
3
by: lsumnler | last post by:
I have started to work through Teach Yourself ASP.Net in 24 hours. The problem that I have noticed is - When I place a textbox Web Control on the screen and then try to change the "ID" in the...
7
by: Filips Benoit | last post by:
Dear all, Tables: COMPANY: COM_ID, COM_NAME, ..... PROPERTY: PRP_ID, PRP_NAME, PRP_DATATYPE_ID, PRP_DEFAULT_VALUE ( nvarchar) COMPANY_PROPERTY: CPROP_COM_ID, CPROP_PRP_ID, CPROP_VALUE...
0
by: Mic docw | last post by:
Hi, I'm struggling with the following problem and after days I feel it's time to seek help. I have 2 datetime (time) variables: Dim BeginHour As DateTime Dim EndHour As DateTime
4
by: HackerisNewKnight | last post by:
Hello, 1) First problem. In my project i need to convert from char* to BYTE*( BYTE is unsigned char), is there any way to make the convertion? BYTE* bite; char* ch="help me, please"; bite =...
6
by: DragonLord | last post by:
The following line is giving me problems. The end result should be value = -1749281834 on the first pass, I am not sure how to convert this to c# seems the ways I have tried are really messing up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.