RE: Module To Parse Format 'Friday, March 13, 2009 04:20 PM EST'
[email protected] ("Metz, Bobby")
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <[email protected]> |
Jim, You don't need to write your own module to handle these. Just use the DateTime::Format::Strptime module. Modify the parser example below with a pattern to suit your own format. $dt will hold your new datetime object with the values parsed from your string format. my $parser = DateTime::Format::Strptime->new(pattern => '%a %b %d %H:%M:%S %Y'); my $dt = $parser->parse_datetime($val); See the CPAN page for all of the pattern options: http://search.cpan.org/~rickm/DateTime-Format-Strptime-1.0900/lib/DateTime/Format/Strptime.pm Regards, Bobby