a L<Time::Piece> object which lets you call useful methods like ymd, mon and
datetime on it.
-In order to set it up, add something like the following to your CDBI Model Class:
+In order to set it up, add something like the following to your CDBI Model Class,
+if you are storing dates as ISO timestamps:
__PACKAGE__->has_a(
mycolumn => 'Time::Piece',
deflate => 'datetime'
);
+or if you prefer to store dates in unix epoch time you can do something like this:
+
+ __PACKAGE__->has_a(
+ mycolumn => 'Time::Piece',
+ inflate => sub { Time::Piece->strptime( shift, "%s" ) },
+ deflate => 'epoch'
+ );
+
If you want to use another format in the database, you can change the strptime call
to fit your format, and use strftime to return it with your custom format to the
database during deflate. See the L<Time::Piece> and L<Class::DBI> docs for more info.