[Catalyst] Format last modified date field ...
Ian Docherty
catalyst at iandocherty.com
Mon Dec 28 21:39:39 GMT 2009
Kiffin
It looks to me like when you print the date field it is doing
stringification of the DateTime object.
Try doing
user.last_modified.ymd
In your template and see what you get. If you get something like
'2009-12-28' then you can output any of the formats that DateTime supports.
Regards
Ian
Kiffin Gish wrote:
> I'm using a last_modified field which is being displayed like this
> "2009-12-28T18:25:28" (what's that 'T' doing in there?) but want to use
> a different format, how?
>
> In the list.tt2 file for listing users, I have:
>
> [% WHILE (user = users_rs.next) -%]
> [% FOREACH col IN users_rs.result_source.columns -%]
> [% user.$col %]</td>
> [% END %]
> [% END -%]
>
> In the schema Users:
>
> __PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp",
> "Core");
> __PACKAGE__->table("users");
> __PACKAGE__->add_columns(
> ...
> "last_modified",
> {
> data_type => "DATETIME",
> default_value => undef,
> is_nullable => 1,
> size => undef,
> },
> );
>
> Thanks alot in advance.
>
>
More information about the Catalyst
mailing list