Re: [Date class] Parsing of the input date in SetDate

From: Date: Fri, 14 Feb 2003 19:13:02 +0000
Subject: Re: [Date class] Parsing of the input date in SetDate
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13303@lists.php.net to get a copy of this message
I've checked this patch into CVS. thanks, baba Frederic Poeydomenge wrote:
Hi, I've found something weird in the Date.php class, perhaps can someone see if it's correct, or if I'm missing something ? Using the following code : include 'Date.php'; $dat = new Date(); $dat->setDate('0000-00-00 00:00:00', DATE_FORMAT_ISO); echo $dat->format('%m/%d/%Y'); "00/00/0" is returned instead of "00/00/0000" which should be the correct answer IMHO... The problem comes from the parsing of the date in the setDate method that converts the year '0000' into an unsigned int 0. This problem can be taken in consideration, for example with the use of a regular expression in setDate (You can find a patch attached) that keeps the correct input '0000' while checking if the date is well formed. Or perhaps does someone have a better idea ? Regards,
-- Baba Z Buehler <baba@BabaZ.com> http://BabaZ.com/ PGP KeyID: 0xA88A6D4C "Those who are willing to sacrifice freedom for security deserve neither." -Benjamin Franklin

« previous php.pear.dev (#13303) next »