![]() |
HELP Display different times for hours.
Code:
DBCode:
1 Month 10 days 9 hours145 - 6.0416 Days Display: Code:
6 Days 42 minutes200 - 8.33 days Code:
1 Week 1 day 3 hours |
I know it seems complicated but can anyone try an attempt?
|
The function below should be OK. Some of the results are different than yours so it might need fine tuning.
PHP Code:
Ouput Code:
13 hours |
They're different because your numbers are accurate (-ish, minus the month one which simply cannot be calculated properly). Since these are in hours with no indication of a fraction available, there is therefore no way to generate any time block < 1 hour in size (so no minutes and no seconds).
There is of course no accurate way to perform this without knowing the starting date. Month is an ambiguous term with days qualifying as anywhere between 28 and 31 (72 hour variation). This is the same reason why things like DateInterval also cannot perform roll-overs as it could determine 32 days as anywhere between 1 month and 1 day or 1 month and 4 days. |
| All times are GMT +1. The time now is 12:24 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.