Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: padding/substr quirk

by ysth (Canon)
on Jan 11, 2004 at 06:52 UTC ( #320438=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -MO=Deparse,-p
    #!perl
    ...
    print "sprintf month= " . (sprintf "%02d", localtime->mon() + 1) . "\n
    +";
    print "sprintf day= " . (sprintf "%02d", localtime->mday()) . "\n";
    ^D
    
  2. or download this
    use Time::localtime;
    BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU"}
    ...
    print((('substr day= ' . substr(('0' . localtime()->mday), (-2))) . "\
    +n"));
    print((('sprintf month= ' . sprintf('%02d', (localtime()->mon + 1))) .
    + "\n"));
    print((('sprintf day= ' . sprintf('%02d', localtime()->mday)) . "\n"))
    +;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2014-09-30 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (384 votes), past polls