note 59322 deleted from function.date by nlopess
| From: | nlopess@php.net | Date: | Fri, 02 Dec 2005 22:33:01 +0000 |
| Subject: | note 59322 deleted from function.date by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99501@lists.php.net to get a copy of this message | ||
Note Submitter: nextblink at hotmail dot com
----
// 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;
}
}