[Dbix-class] Problem with using InflateColumn::DateTime
J Cook
jcook713 at gmail.com
Sat Sep 30 17:39:00 CEST 2006
Hi,
I'm trying to reformat a date field from a MySQL table - wanting to go
from yyyy-mm-dd to mm/dd/yyyy when displayed on a webpage. So, following
some advice I did the following:
package DB::Main::Book;
use base qw/DBIx::Class/;
# Load required DBIC stuff
__PACKAGE__->load_components(qw/PK::Auto Core InflateColumn::DateTime/);
# Set the table name
__PACKAGE__->table('books');
# Set columns in table
__PACKAGE__->add_columns(date => { data_type => 'date' });
__PACKAGE__->add_columns(qw/id book author date/);
# # Set the primary key for the table
__PACKAGE__->set_primary_key('id');
Next in my code(Mason page):
<% $quote->depart_date->mdy() %> depart date<br>
I get the following result:
Can't call method "mdy" without a package or object reference at
It works fine without the '->mdy()' but of course doesn't format the
date as wished for.
I followed the doc and I've tried several variations but this looks like
it should work according to how the doc looks.
Any suggestions?
Justin
More information about the Dbix-class
mailing list