note 54458 added to function.time
| From: | davenewt at osu1 dot php dot net | Date: | Tue, 05 Jul 2005 09:11:05 +0000 |
| Subject: | note 54458 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91460@lists.php.net to get a copy of this message | ||
Re the note from 'shazow'... I tried using the given function, passing it an SQL timestamp
(in the form YYYY-MM-DD hh:mm:ss) but the number of months it was returning seemed way off...
thought I should post back in case anyone else was scratching their head over it...
Noticed the following code:
<?php
// Months
$elapsedString = round($elapsedTime/60/60/24/12, $roundTo) . " months";
?>
...which is assuming 12 days in a month? I changed this to:
<?php
// Months
$elapsedString = round($elapsedTime/60/60/24/30, $roundTo) . " months";
?>
(I'm assuming 30 days per month as in my application I don't need to be exact... not sure
how you could be?)
Hope this is an acceptable 'hack'. I'm no professional!
Cheers,
Dave.
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54458
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54458&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54458&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54458&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54458&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54458&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54458&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54458&report=yes
Search -- http://master.php.net/manage/user-notes.php