Re: Maintainer of Date_Calc
| From: | Tomas V.V.Cox | Date: | Sun, 05 Aug 2001 16:38:19 +0000 |
| Subject: | Re: Maintainer of Date_Calc | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1306@lists.php.net to get a copy of this message | ||
Erik Hjortsberg wrote:
>
> Anyways, does anybody know any method of converting an arbitary number of
> days to a correct date, such as '2001-01-40' => '2001-02-09'?
list($year, $month, $day) = split('-', $date);
while ($day > ($d = DATE_Calc::daysInMonth($month, $year)) {
$day -= $d;
if ($month++ > 12) {
$month = 1;
$year++;
}
}
return implode ('-', array($year, $month, $day));
(that was coding directly in Netscape so don't expect it to work, just
"wanna" help :-)
Tomas V.V.Cox