Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Time Piece Error Parsing

by runrig (Abbot)
on Mar 09, 2016 at 16:42 UTC ( #1157183=note: print w/replies, xml ) Need Help??


in reply to Time Piece Error Parsing

Today is the 9th. If you're going to mash digits together without delimiters, the month AND the day of month each need to be 2 digits.

Replies are listed 'Best First'.
Re^2: Time Piece Error Parsing
by Anonymous Monk on Mar 09, 2016 at 18:07 UTC
    Interesting, so this should work even if the month has two digits.:
    $date = $t->strptime(sprintf("%02d",$t->mon).sprintf("%02d",$t->day_of +_month).$t->year, '%m%d%Y');
      Alternatively:
      $date = $t->strptime(sprintf("%02d%02d%04d",$t->mon,$t->day_of_month,$ +t->year), '%m%d%Y');

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2019-04-19 22:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (107 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!