Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Answer: How can I format the output of localtime?

by Sol-Invictus (Scribe)
on Feb 08, 2004 at 22:51 UTC ( #327512=categorized answer: print w/replies, xml ) Need Help??

Q&A > dates and times > How can I format the output of localtime? - Answer contributed by Sol-Invictus

at it's simplest:

print scalar(localtime(time)),"\n";

Replies are listed 'Best First'.
Re: Answer: How can I format the output of localtime?
by Roy Johnson (Monsignor) on Feb 09, 2004 at 22:00 UTC
    Well, at its simplest, you can leave off the arg to localtime (and all the parens):
    print scalar localtime, "\n";
    Update: Well, several have found this post downvotable, but nobody has explained why. It's not incorrect. It offers an improvement over the post to which it is a reply (and which, inexplicably, has been significantly upvoted by comparison).

    You're not going to change its placement by downvoting it; it's attached to its parent, and it's the only response.

    In the helpful spirit of PerlMonks, could someone offer some reason that this post would be a negative vote magnet?


    The PerlMonk tr/// Advocate
      Who knows. FWIW, I like your solution better than the parent.

      Is there some unspoken rule about golfing in the Q&A section?

      Cheers,
      Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2020-10-24 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (248 votes). Check out past polls.

    Notices?