[Dbix-class] InflateColumn::DateTime - how to use it?
Matt S Trout
dbix-class at trout.me.uk
Thu May 10 14:56:38 GMT 2007
On Thu, May 10, 2007 at 02:05:44PM +0100, RA Jones wrote:
> Adam Herzog wrote:
> >I think InflateColumn::DateTime probably has to be _before_ Core:
> >__PACKAGE__->load_components(qw/InflateColumn::DateTime Core/);
> >
> Thanks, that did the trick.
> >Note also that PK::Auto is included in 'Core', so you don't have to
> >specify it.
> >
> Noted (and corrected).
> >>On reflection though, maybe InflateColumn is not the correct method
> >>for what I really want - to globally reformat date fields to EU format.
> >
> >If you're certain you'll only want an EU formatted date, you can use
> >DBIx::Class::InflateColumn in your resultset and add the code to
> >inflate to whatever you'd like. Check the InflateColumn docs for an
> >example.
> >
> Currently doing: ( join '.', $hits->date->day, $hits->date->month,
> $hits->date->year ) in the controllers - repetitive and probably a less
> desirable tmtowtdi.
MACRO format_datetime(dt) dt.strftime('%d.%m.%Y');
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
More information about the Dbix-class
mailing list