Date methods simplified
| From: | Nicolas Hoizey | Date: | Tue, 21 May 2002 16:42:35 +0000 |
| Subject: | Date methods simplified | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6295@lists.php.net to get a copy of this message | ||
Hi all,
I'm looking at the Date package, and I wonder why addSeconds and
substractSeconds are so big. I think addSeconds could be the
following:
function addSeconds($sec)
{
$this->setDate($this->getDate(DATE_FORMAT_UNIXTIME) + $sec, DATE_FORMAT_UNIXTIME);
}
And then substractSeconds would be:
function substractSeconds($sec)
{
$this->addSeconds(-$sec);
}
I think there are several other methods which could be shortened.
Regards,
-Nicolas
--
Nicolas "Brush" HOIZEY
Free PHP projects http://www.phpheaven.net
Veille tous azimuts http://www.gasteroprod.com
Clever Age http://www.clever-age.com