Hi Nick,

> my $article = $c->model('Pacdb::File::Article')->find_or_create(id =>
> $id);
> $article->set_column(date => $params{date}); # format dd/mm/yyyy
> $article->update;

When setting your date column you have to pass in a DateTime object not a
string like so:

$article->date( DateTime->now );

DateTime::Format::MySQL->format_date expects a DateTime object and will
then make an appropriately formatted MySQL datetime string out of it.
If you need to parse a date stored in a string you could use
DateTime::Format::Strptime (I think) to transform it into a DateTime object
first.

Also check out the handy DBIx::Class::InflateColumn::DateTime component
which saves you from putting inflating/deflating methods into every model.

--Tobias

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to