Use Date::Parse and Date::Format, it works much the same way.  It is part of
the TimeDate package on CPAN.

use Date::Parse;
use Date::Format;

$date =  time2str("%Y-%m-%d", str2time("22-January-2002"))'

Rob

-----Original Message-----
From: Lysander [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 11:29 AM
To: [EMAIL PROTECTED]
Subject: Date Manipulation


I was wondering if there is an easy way to convert between date formats in
PERL.

Specifically I need to rewrite "22-January-2002" as "2002-01-22" prior to
inserting into a date field in MySQL.

In PHP (which is what I usually code in) I would just do something like

$date = date("Y-m-d",strtotime("22-January-2002"));

If anyone could give me a PERL equivalent of this line of code I would
greatly appreciate it.

Thanks

Sheridan Saint-Michel



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to