Home » Date and Time » Date » Bug #6711
getWeekFromDate method
Details
| Request #6711 | getWeekFromDate method |
|---|---|
| Submitted | 2006-02-07 01:35 UTC |
| From | pear at spiration dot co dot uk |
| Assigned | pajoye |
| Status | Wont fix |
| Package | Date |
| PHP Version | 4.4.0 |
| OS | any |
| 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");