•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,495 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,739 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 469 | Replies: 8 | Solved
![]() |
•
•
Join Date: Jun 2008
Posts: 45
Reputation:
Rep Power: 1
Solved Threads: 2
I have tried this in MySQL by the way:
And this does not work.
Anyone?
SQL Syntax (Toggle Plain Text)
TIMEDIFF(TIMEDIFF(u.hour_end, u.hour_begin),TIME(l.u_contract) / 5) AS contract
And this does not work.
Anyone?
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
What exactly do you want ? How is the value stored in the database and how do you want to split it ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 759
Reputation:
Rep Power: 2
Solved Threads: 61
Like this?
list($hrs, $mins) = explode(":", $time);
$mins += $hrs * 60;
$endresult = $mins/5;
echo $endresult; Last edited by R0bb0b : Jun 18th, 2008 at 11:06 am.
•
•
Join Date: Jun 2008
Posts: 45
Reputation:
Rep Power: 1
Solved Threads: 2
You make a little mistake I think, the code you are showing must be, I think:
This code is not what I actually intended, because when you take for exampble the time 37:00, you get with the code above as $endresult: 7.4. And the $result must be 7:24.
php Syntax (Toggle Plain Text)
list($hrs, $mins) = explode(":", $time); $mins += $hrs / 60; $endresult = $hrs/5; echo $endresult;
This code is not what I actually intended, because when you take for exampble the time 37:00, you get with the code above as $endresult: 7.4. And the $result must be 7:24.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
php Syntax (Toggle Plain Text)
<?php $time = "37:00"; list($hrs, $mins) = explode(":", $time); $mins += $hrs * 60; $endresult = $mins/5; echo date("H:i",mktime(0,$endresult,0,0,0,0)); ?>
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 759
Reputation:
Rep Power: 2
Solved Threads: 61
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Favorite All Time Games (Geeks' Lounge)
- Help On Time Complexity Algorithm (Computer Science and Software Design)
- divide (C++)
- how to find execution time milliseconds (C)
- Round Robin Scheduler (C)
- Won't load past startup; Divide overflow error? (Troubleshooting Dead Machines)
- Slooow computer... (Windows 9x / Me)
Other Threads in the PHP Forum
- Previous Thread: challenge 4 beginners
- Next Thread: help please login problem this time



Linear Mode