Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: formatting datetime with strftime

by Cristoforo (Deacon)
on Jul 22, 2013 at 15:51 UTC ( #1045684=note: print w/ replies, xml ) Need Help??


in reply to formatting datetime with strftime

Time::Piece, (was first released with perl v5.9.5), would solve this simply.

#!/usr/bin/perl use strict; use warnings; use Time::Piece; my $datetimestring = "4/5/13 16:09"; my $t = Time::Piece->strptime($datetimestring, "%m/%d/%y %H:%M"); print $t->strftime("%b %d, %Y %H:%M:%S");
Prints Apr 05, 2013 16:09:00

Chris


Comment on Re: formatting datetime with strftime
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-11-25 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (148 votes), past polls