Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Format user entered date?

by astroboy (Chaplain)
on Sep 01, 2009 at 00:40 UTC ( #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


Comment on Re: Format user entered date?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (17)
As of 2014-12-18 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (65 votes), past polls