Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Format user entered date?

by astroboy (Chaplain)
on Sep 01, 2009 at 00:40 UTC ( [id://792501]=note: print w/replies, xml ) Need Help??


in reply to Format user entered date?

#!/usr/local/bin/perl use DateTime::Format::Natural; my @dates = ('Yesterday', '21st August 2009', '2009-07-17 2:35pm'); my $output_format = '%d/%m/%Y %H:%M:%S'; foreach my $date (@dates) { my $parser = DateTime::Format::Natural->new; my $dt = $parser->parse_datetime($date); print $dt->strftime($output_format), "\n";; }
Output
31/08/2009 00:00:00 21/08/2009 00:00:00 17/07/2009 14:35:00

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://792501]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-24 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found