Re: convert numerical day of week
| From: | Robert Cummings | Date: | Wed, 23 May 2007 13:07:57 +0000 |
| Subject: | Re: convert numerical day of week | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255395@lists.php.net to get a copy of this message | ||
On Wed, 2007-05-23 at 10:31 +0300, Robin Vickery wrote:
> On 22/05/07, Robert Cummings <robert@interjinn.com> wrote:
> > On Tue, 2007-05-22 at 13:47 -0500, Greg Donald wrote:
> > > On 5/22/07, Robert Cummings <robert@interjinn.com> wrote:
> > > > Nothing said it was important, but why implement a half-assed solution
> > > > when you can implement a superior solution in as much time?
> > >
> > > Your solution contains overhead you don't even know you need. Coding
> > > for locales is an edge case since most PHP installs will find the
> > > server settings sufficient.
> > >
> > > http://en.wikipedia.org/wiki/YAGNI
> > >
> > > > I'll accept ignorance and sloppiness as reasons... albeit not good
> > > > reasons.
> > >
> > > You assume too much and your solution is bloated. Accept that.
> >
> > No, your solution is bloated. Mine may run a tad slower, but it consumes
> > less memory since it uses the weekday names already defined in the
> > locale. Yours redefines the strings thus requiring that much extra
> > storage. Yours is redundant with information already available in the
> > locale. The YAGNI claim is irrelevant here since I'm producing the
> > requested functionality that the poster obviously needs. Whether I use
> > your method or my method is irrelevant to YAGNI.
>
> they're all bloated:
>
> print jddayofweek($day_number, 1);
Very nice, and it's based off the locale. I wasn't aware of these
functions... Looks like I've learnt something :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'