Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 taking refuge in the Monastery: (13)
As of 2015-07-01 16:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (12 votes), past polls