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 avoiding work at the Monastery: (7)
As of 2014-07-13 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls