PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Date and Time » Date » Bug #6711

getWeekFromDate method

Details

Request #6711getWeekFromDate method
Submitted2006-02-07 01:35 UTC
Frompear at spiration dot co dot uk
Assignedpajoye
StatusWont fix
PackageDate
PHP Version4.4.0
OSany
Roadmaps(Not assigned)

Comments

[2006-02-07 01:35 UTC] pear at spiration dot co dot uk

Description:
------------
This is more of a request to add a method to the Date_Calc class. The method would return the date a week after the date provided. This differs to existing methods, which return the first day of the following week, or the first working day.

The method would look like this:

/**
* Returns the date in a week's time from provided date
*
* @return string the date in a week's time from the date provided
*
* @access public
* @static
*/
function getWeekFromDate($day = 0, $month = 0, $year = 0)
{
for($i=0;$i<7;$i++){
$tempdate= Date_Calc::nextDay($day,$month,$year,'%Y-%m-%d');
list($year,$month,$day)=explode("-",$tempdate);
}
return $tempdate;
}

Test script:
---------------
A simple example of this in use would look like :

$newdate=Date_Calc::getWeekFromDate($day,$month,$year,"%Y-%m-%d");