Re: Returning A Class::Date Object
[prev]
[thread]
[next]
[Date index for 2005/01/10]
On Mon, Jan 10, 2005 at 09:10:19PM +0000, Jay Hargreaves wrote:
> Hi y'all!
>
> I have found Class::Date to be a very useful date formatting routine and
> as such I would like to return a Class::Date object (rather than the
> actual value) for any date fields in my database.
>
> Presumably it might also be a good idea to set values in the database
> from a Class::Date object, since it has various parsing facilities
> available.
>
> Can someone please tell me a good way to do this is? Do I use a trigger?
Have a look at the inflate and deflate stuff in the Class::DBI pod, which
expands on the following synopsis example:
Music::CD->has_a(
reldate => 'Time::Piece',
inflate => sub { Time::Piece->strptime(shift, "%Y-%m-%d") },
deflate => 'ymd',
);
--
Bring me my etherkiller; Oh clouds unfold! / Bring me the magic smoke of desire
I shall not cease from mental fight / Nor shall my LART rest in my hand
Till we have buried the bodies / Of all the lusers in all this land
-- rpg, ASR [ My homepage is http://www.trout.me.uk/ ]
|
|
Re: Returning A Class::Date Object
Matt S Trout 21:23 on 10 Jan 2005
|