note 56766 deleted from function.time by aidan
| From: | aidan@php.net | Date: | Sat, 08 Oct 2005 01:01:57 +0000 |
| Subject: | note 56766 deleted from function.time by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96594@lists.php.net to get a copy of this message | ||
Note Submitter: slinden at gmail dot com
----
I still think there is an error in shazow's code
Correct code:
<?php
else if($elapsedTime<(60*60*24*365*2)) {//if the given timestamp is less the 24 months ago,
display MONTHS
$elapsedString = round($elapsedTime/60/60/24/30, $roundTo) . " months";
}?>
flawed code:
<?php
else if($elapsedTime<(60*60*24*365*2)) {//if the given timestamp is less the 24 months ago,
display MONTHS
$elapsedString = round($elapsedTime/60/60/24/12, $roundTo) . " months";
}?>
to get months, we need to go from:
60 seconds->60 minutes->24 hours->30 days
not like he did from
60 seconds->60 minutes->24 hours->12 days
I had 5 month old messages being displayed as 17 months or something, due to this little error, be
careful if you use this otherwise wonderful piece of code :)