Re: Date-class

From: Date: Thu, 19 Jul 2001 14:00:46 +0000
Subject: Re: Date-class
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-889@lists.php.net to get a copy of this message
At 02:20 2001-07-19 +0200, you wrote:
Handy. How do you deal with timezones? To comply more with other classes, the "asXxx" methods should be renamed to "toXxx" (we havre toString in a bunch of places, inspired by Java) The date comparison function should return -1/0/1 so it cab be used with sorting.
Hmm, I'm not sure how to handle timezones. Do you mean one should specify the timezone directly? Well, 'toXxx' is more compliant to current standards and I'll change it. I do think however that Sun got it semantically wrong. 'toSomething' implies that the object will be transformed 'into' something else. I.e. $apple->toCheese() would turn the apple _into_ a cheese. 'As' on the other hand implies that you'll get a representation of the same value _as_ another presentation. I.e. $apple->asCheese() would return a presentation of how the apple would look like if it was a cheese. Thus $date->toString() would change $date to a string while $date->asString() would return a disattached representation of $date as a string The date comparison function returns -1/0/1 (by using strcmp). /erik hjortsberg

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