note 59322 added to function.date
| From: | nextblink at hotmail dot com | Date: | Fri, 02 Dec 2005 22:31:43 +0000 |
| Subject: | note 59322 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99500@lists.php.net to get a copy of this message | ||
// Name: Get Future Date From Passed In
// Date
// Description: When you need to find a future
// date based on a date your passing
// in (format YYYYMMDD). The function takes a date
// and returns the future date based on that passed in
// date.
// Note:
// Change the output by changing the "Ymd"
// prameters.i.e. m-d-Y or m-d-y, etc.
Note:
The inputs are
Your start date YYYYMMDD
Your days to progress #
i.e. GetFutureDate('20051202','45')
// This will progress the date 2005 Dec, 02 by 45 days. This becomes powerful when you need to know
progressive month, day and year.
// Hope This Helps,
// John Lin
// Inputs: Date & Days needed in the future
//
// Returns:YYYYMMDD
function GetFutureDate($strDate,$strFutureDays) {
//Date Format Recieved = 20050101
if (strlen($strDate) == 8) {
$strStartYear = substr($strDate,0,4);
$strStartMonth = substr($strDate,4,2);
$strStartDay = substr($strDate,-2);
$startDate = mktime (0,0,0,$strStartMonth,$strStartDay,$strStartYear);
$finishDate = $startDate + ($strFutureDays * 24 * 60 * 60);
$finishDate = date("Ymd",$finishDate);
return $finishDate;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59322
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59322&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59322&report=yes
Search -- http://master.php.net/manage/user-notes.php