Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045684]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2016-12-09 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (148 votes). Check out past polls.