note 54225 added to function.time
| From: | shazow at gmail dot com | Date: | Tue, 28 Jun 2005 01:07:44 +0000 |
| Subject: | note 54225 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91043@lists.php.net to get a copy of this message | ||
RE: tom at depman dot com
Your way doesn't actually give the right answer. Here's an easier way of fetching the end
date if you only have the start date and term in months:
<?php
$start_date = "2005-01-03";
$term = 36; // Number of months
$end_date = date("Y-m-d",strtotime("+".$term." months",
strtotime($start_date)));
echo $end_date; // Gives: 2008-01-03
?>
- shazow
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54225
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54225&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54225&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54225&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54225&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54225&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54225&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54225&report=yes
Search -- http://master.php.net/manage/user-notes.php