|
|
|
Get a Future Date
3
This function will take four arguments, the year, month, day and number of days in the future you want to go and return to you as an array (year,month,day) of that date.
It is a simple function that is only for convenience. It is meant to be used in conjunction with the list() command.
It is a simple function that is only for convenience. It is meant to be used in conjunction with the list() command.
/**
* Function returns a date in the future by increasing the days
*
* @param int $month
* @param int $year
* @param int $day
* @param int $numDays
* @return array
*/
function futureDate($month,$year,$day,$numDays) {
return explode('-',date('Y-m-d',mktime(0,0,0,$month,$day+$numDays,$year)));
}
// Example Use - Find a date 45 days in the future Starting with 2-15-2009
list($year,$month,$day) = futureDate(2,2009,15,45);
// Outputs 04-01-2009
echo $month . "-" . $day . "-" . $year;




There are currently no comments for this snippet.