note 57474 added to function.time
| From: | darkrealm dot drjj at gmail dot com | Date: | Wed, 05 Oct 2005 10:29:54 +0000 |
| Subject: | note 57474 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96410@lists.php.net to get a copy of this message | ||
if you ask me this would be a lot better (and more precies)
<?php
else if($elapsedTime<(60*60*24*365*2)) {//if the given timestamp is less the 24 months ago,
display MONTHS
$years = date("Y",$elapsedTime) // (just you you get a year if its more then 12 months
ago!);
$months = date("m",$elapsedTime); // Get the number of months elapsed since the years been
complete
$elapsedString = ($years * 12) + $months . " Months";
?>
I think that should work and it would be more precies. not totally though, for instance it does not
take into account when its a Leap Year
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57474
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57474&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57474&report=yes
Search -- http://master.php.net/manage/user-notes.php