On Wed, 19 Mar 2014 10:32:38 -0400
"Dave Rolsky via RT" <bug-DateTime@rt.cpan.org> wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=94001 >
>
> On Wed Mar 19 06:25:45 2014, BIGPRESH wrote:
> > dmy() / hms() accept a parameter to indicate the separator to
> > override the default, e.g. dmy('/')
> >
> > I think datetime() should accept a parameter to override the default
> > "T" separator, so e.g. datetime(' ') would give '2014-03-19
> > 10:23:00' instead of '2014-03-19T10:23:00' - simply because saying
> > $dt-
> > >datetime(' ') seems nicer than e.g. join ' ', $dt->dmy, $dt->hms;
>
> Well, by that logic it should accept three parameters, for date
> separator, time separator and the separator between date & time.
>
> That could be ok, but you can already get any format you want out of
> format_cldr() and strftime(), so I'm not sure if this is really
> necessary.
Hmm, good point - I guess accepting a parameter to set the separator
between the date and time, but not letting you supply the separator to
use in the date or the time would seem odd, too.
Perhaps just using e.g. DateTime::Format::MySQL is the right approach,
rather than cluttering DateTime with extra stuff for shorthand.
It pains me that $datetime->datetime() is *so* close to what I want,
but not quite, and that there's no way to get it to do what I want -
but at the end of the day I'm looking for a format, which can be
obtained using a DateTime::Format::* module that exists fairly easily,
or saying $datetime->strftime('%F %T'), and there's a good case for
keeping stuff for specific formats out of DateTime itself and in
formatter classes.
So, yeah, fair point.
Cheers!