[another] Q on Date Package...
| From: | jsWalter | Date: | Tue, 05 Aug 2003 19:27:27 +0000 |
| Subject: | [another] Q on Date Package... | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-19303@lists.php.net to get a copy of this message | ||
I was wondering, you know, why something was done the way it was done.
(It's the way I am, always causing trouble)
With this pacakge you instantiate a new Date Object like this...
$myDate = new Date();
OK, this gets the curretn date.
$myDate = new Date('2001-01-01 13:12:20');
this defines a new date with the DATE_FORMAT_ISO structure.
All good. The method is smart enough to know what the passed in value means.
Now, setDate() is different. ??
To set a new ate on an existing Date Object...
$myDate->setDate('2001-01-01 13:12:20', DATE_FORMAT_ISO);
This method has to be told what format the data is being sent is. It does
not decode it as new Date() method does.
May I ask why?
I modifed my version of setDate() to mimic new Date() to see if it could be
done, in case was missing something. It works fine.
Can anyone enlighten me on why this method is done this way?
(see, I cause trouble)
Thanks
walter