Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: How do I remove newline character from a number got from unix command

by tousifp (Novice)
on Sep 04, 2013 at 12:22 UTC ( #1052318=note: print w/ replies, xml ) Need Help??


in reply to Re: How do I remove newline character from a number got from unix command
in thread How do I remove newline character from a number got from unix command

How can I have date and month in a similar fashion? I need like this : 2013-09-04 and "Sep 04"


Comment on Re^2: How do I remove newline character from a number got from unix command
Re^3: How do I remove newline character from a number got from unix command
by hdb (Prior) on Sep 04, 2013 at 12:30 UTC
Re^3: How do I remove newline character from a number got from unix command
by Tux (Monsignor) on Sep 04, 2013 at 12:37 UTC
    my $date_as_YYYY_MM_DD = do { my @d = localtime; sprintf "%04d-%02d-%02d", $d[5] + 1900, ++$d[4], $d[3]; };

    but that is most likely better done with POSIX' strftime:

    use POSIX qw( strftime ); my $d_YMD = POSIX::strftime ("%Y-%m-%d", localtime); my $d_Md = POSIX::strftime ("%d %b", localtime); # I prefer 04 Sep ov +er Sep 04

    Enjoy, Have FUN! H.Merijn
      t a n k s!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2015-07-05 23:40 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 (68 votes), past polls